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
This commit is contained in:
Cédric Krier committed 2019-10-24 19:02:31 +02:00
1 parent e643af7f20
commit 577712e15b
1 file changed
+10
+10
View File
@@ -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: