diff --git a/tryton/common/environment.py b/tryton/common/environment.py index 296cf9eee6..f644537bfc 100644 --- a/tryton/common/environment.py +++ b/tryton/common/environment.py @@ -4,15 +4,20 @@ 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 + assert eval_type in ('eval', 'on_change') + 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) diff --git a/tryton/gui/window/view_form/model/record.py b/tryton/gui/window/view_form/model/record.py index 46a9c7b07c..40917df90a 100644 --- a/tryton/gui/window/view_form/model/record.py +++ b/tryton/gui/window/view_form/model/record.py @@ -434,7 +434,7 @@ class Record(SignalEvent): 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('.'):