diff --git a/proteus/proteus/__init__.py b/proteus/proteus/__init__.py index 5a0fb750d2..7fb283e9e8 100644 --- a/proteus/proteus/__init__.py +++ b/proteus/proteus/__init__.py @@ -1152,9 +1152,8 @@ class Model(object): values.update(self._on_change_args(on_change)) if values: context = self._context - changes = getattr(self._proxy, 'on_change')(values, names, context) - for change in changes: - self._set_on_change(change) + change = getattr(self._proxy, 'on_change')(values, names, context) + self._set_on_change(change) values = {} fieldnames = set(names) diff --git a/sao/src/model.js b/sao/src/model.js index cf8f0f338d..b55571c5f3 100644 --- a/sao/src/model.js +++ b/sao/src/model.js @@ -1071,9 +1071,9 @@ [values], this.get_context(), false)); } } else { - changes = this.model.execute( + changes = [this.model.execute( 'on_change', - [values, fieldnames], this.get_context(), false); + [values, fieldnames], this.get_context(), false)]; } } catch (e) { return; diff --git a/tryton/tryton/gui/window/view_form/model/record.py b/tryton/tryton/gui/window/view_form/model/record.py index fd383cd9ad..e898b454c2 100644 --- a/tryton/tryton/gui/window/view_form/model/record.py +++ b/tryton/tryton/gui/window/view_form/model/record.py @@ -577,9 +577,9 @@ class Record: 'on_change_' + fieldname, values, context=self.get_context())) else: - changes = RPCExecute( - 'model', self.model_name, 'on_change', - values, fieldnames, context=self.get_context()) + changes = [RPCExecute( + 'model', self.model_name, 'on_change', + values, fieldnames, context=self.get_context())] except RPCException: pass else: diff --git a/trytond/trytond/model/modelview.py b/trytond/trytond/model/modelview.py index d028a4d6cf..5c3ee8ea7a 100644 --- a/trytond/trytond/model/modelview.py +++ b/trytond/trytond/model/modelview.py @@ -68,7 +68,7 @@ class ModelView(Model): super(ModelView, cls).__setup__() cls.__rpc__['fields_view_get'] = RPC(cache=dict(days=1)) cls.__rpc__['view_toolbar_get'] = RPC(cache=dict(days=1)) - cls.__rpc__['on_change'] = RPC(instantiate=0) + cls.__rpc__['on_change'] = RPC(instantiate=0, result=on_change_result) cls.__rpc__['on_change_with'] = RPC(instantiate=0) cls.__rpc__['on_change_notify'] = RPC(instantiate=0) cls._buttons = {} @@ -758,13 +758,12 @@ class ModelView(Model): return func return decorator + @on_change def on_change(self, fieldnames): for fieldname in sorted(fieldnames): method = getattr(self, 'on_change_%s' % fieldname, None) if method: method() - # XXX remove backward compatibility - return [self._changed_values] def on_change_with(self, fieldnames): from .modelstorage import ModelStorage