From 577712e15bcd3eefe6e93a283a590901a6cb32ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 24 Oct 2019 19:02:31 +0200 Subject: [PATCH] Ensure on_change arguments are loaded As proteus is lazy about field it read, after a save call there is no field read. But if the next on_change need the value of a field no loaded, it will send an empty value because Eval accessors do not trigger a read. So to behave like other client (which load displayed fields), we ensure to load the needed arguments. issue8450 review264411005 --- proteus/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/proteus/__init__.py b/proteus/__init__.py index 7e7b5adb94..40075536f0 100644 --- a/proteus/__init__.py +++ b/proteus/__init__.py @@ -1034,6 +1034,16 @@ class Model(object): return values def _on_change_args(self, args): + # Ensure arguments has been read + for arg in args: + record = self + for i in arg.split('.'): + if i in record._fields: + getattr(record, i) + elif i == '_parent_' + record._parent_name: + getattr(record, record._parent_name) + record = record._parent + res = {} values = _EvalEnvironment(self, 'on_change') for arg in args: