[IMP] api: improve documentation of `api.onchange`

This fixes #3968.
This commit is contained in:
Raphael Collet 2015-10-02 11:58:44 +02:00
parent 66ce0ac970
commit 446d59fd44
1 changed files with 9 additions and 0 deletions

View File

@ -171,6 +171,15 @@ def onchange(*args):
when one of the given fields is modified. The method is invoked on a when one of the given fields is modified. The method is invoked on a
pseudo-record that contains the values present in the form. Field pseudo-record that contains the values present in the form. Field
assignments on that record are automatically sent back to the client. assignments on that record are automatically sent back to the client.
The method may return a dictionary for changing field domains and pop up
a warning message, like in the old API::
return {
'domain': {'other_id': [('partner_id', '=', partner_id)]},
'warning': {'title': "Warning", 'message': "What is this?"},
}
""" """
return lambda method: decorate(method, '_onchange', args) return lambda method: decorate(method, '_onchange', args)