Added doc about Function field

This commit is contained in:
Bertrand Chenal committed 2008-10-06 14:40:59 +02:00
1 parent d520453c42
commit 59638e9dbe
1 file changed
+19
+19
View File
@@ -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
`````````````````````````