Call of default_<field name>() method in Tryton 5.2

In Tryton 4.x default_<field name>() method is called every time a new record is added.
In Tryton 5.x this method is called only once. Why?

Because there is a cache on RPC call now since 5.2. For Model.default_get it is of 5 minutes by default.
If you have a model which require to be called each time, you can update its RPC.cache for default_get.

Can you give an example please?

@classmethod
def __setup__(cls):
    super().__setup__()
    cls.__rpc__['default_get'].cache = None

It works. Thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.