Reviewers: ,
Please review this at http://codereview.tryton.org/37002/
Affected files:
M tryton/common/environment.py
M tryton/gui/window/view_form/model/record.py
Index: tryton/common/environment.py
===================================================================
--- a/tryton/common/environment.py
+++ b/tryton/common/environment.py
@@ -4,15 +4,19 @@
class EvalEnvironment(dict):
- def __init__(self, parent, check_load):
+ def __init__(self, parent, check_load, eval_type='eval'):
super(EvalEnvironment, self).__init__()
self.parent = parent
self.check_load = check_load
+ self.eval_type = eval_type
def __getitem__(self, item):
if item == '_parent_' + self.parent.parent_name and
self.parent.parent:
return EvalEnvironment(self.parent.parent, self.check_load)
- return self.parent.get_eval(check_load=self.check_load)[item]
+ if self.eval_type == 'eval':
+ return self.parent.get_eval(check_load=self.check_load)[item]
+ else:
+ return self.parent._get_on_change_args([item])[item]
def __getattr__(self, item):
return self.__getitem__(item)
Index: tryton/gui/window/view_form/model/record.py
===================================================================
--- a/tryton/gui/window/view_form/model/record.py
+++ b/tryton/gui/window/view_form/model/record.py
@@ -434,7 +434,7 @@
values[name] = field.get_on_change_value(self,
check_load=False)
if self.parent and self.parent_name:
values['_parent_' + self.parent_name] = \
- common.EvalEnvironment(self.parent, False)
+ common.EvalEnvironment(self.parent, False, 'on_change')
for arg in args:
scope = values
for i in arg.split('.'):
--
[email protected] mailing list