From 446d59fd4484d0314745bf270bc5e3fd7adbdc8e Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Fri, 2 Oct 2015 11:58:44 +0200 Subject: [PATCH] [IMP] api: improve documentation of `api.onchange` This fixes #3968. --- openerp/api.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openerp/api.py b/openerp/api.py index 0304e5cdf53..e5cc47e716f 100644 --- a/openerp/api.py +++ b/openerp/api.py @@ -171,6 +171,15 @@ def onchange(*args): 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 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)