function-field calling order

Asked by Martin Collins

What determines the order that function-field functions get called?

I have a model with several function fields. Some of the functions get called repeatedly but some don't get called at all. The order seems random.

Since I cannot rely on all functions being called I would like to chain them, as the values of some fields depend on other fields which are themselves set by functions. How does such a function get the values set by previous functions? Do I really have to write the object in each function then read it in the next? Seems a little inefficient.

I tried using on_change to call the functions but it is not triggered when a field is changed by a function.

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
xrg
Solved:
Last query:
Last reply:
Revision history for this message
Best xrg (xrg) said :
#1

On Wednesday 17 November 2010, you wrote:
> New question #134332 on OpenObject Server:
> https://answers.launchpad.net/openobject-server/+question/134332
>
> What determines the order that function-field functions get called?
>
Typically, the order is just random. See the definition of a pythonic dict and
the notes about its' iterations.

However, if you really want inter-dependent function fields, there is the
"multi" option which does that: you define a common function for them and do
all the tricks inside that function.

Revision history for this message
Martin Collins (mkc-steadfast) said :
#2

Thanks xrg, that solved my question.