From 6e88e99aae6d89a0170e45cc96085d58c127b6fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 5 Mar 2012 23:39:58 +0100 Subject: [PATCH] Add grouped calls to on_change_with review251001 --- CHANGELOG | 1 + trytond/model/model.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 5d56650e22..73aef6139b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add group call to on_change_with * Allow to get fuzzy translation * Allow to customize server timezone * Add richtext widget for WYSIWYG editor diff --git a/trytond/model/model.py b/trytond/model/model.py index bb8ddd658b..ef5ca768e1 100644 --- a/trytond/model/model.py +++ b/trytond/model/model.py @@ -71,6 +71,7 @@ class Model(WarningErrorMixin, URLMixin): self._rpc = { 'default_get': False, 'fields_get': False, + 'on_change_with': False, } self._inherit_fields = [] self._error_messages = {} @@ -616,3 +617,10 @@ class Model(WarningErrorMixin, URLMixin): if i not in fields_names: del res[i] return res + + def on_change_with(self, fieldnames, values): + changes = {} + for fieldname in fieldnames: + changes[fieldname] = getattr(self, + 'on_change_with_%s' % fieldname)(values) + return changes