diff --git a/doc/models.rst b/doc/models.rst index 5149515694..0a61a8d741 100644 --- a/doc/models.rst +++ b/doc/models.rst @@ -409,6 +409,25 @@ used in the method definition, hence adapting the way the method is called. +Another way to tackle Function implementation is to pass a dictionary +to the ``args`` argument on the field definition. It will be forwarded +to the function call: + +.. highlight:: python + +:: + + state = fields.Function( + 'get_state', type='selection', string='Total Service', + args={'key':'value'}, + selection=[('draft','Draft'),('done','Done')], + ) + + def get_state(self, cursor, user, ids, names, arg, context=None): + # [...] + if arg.get('key'): + pass # do something with 'value' + Search on function fields `````````````````````````