diff --git a/tryton/common/domain_inversion.py b/tryton/common/domain_inversion.py index 335eee831a..15c3b58183 100644 --- a/tryton/common/domain_inversion.py +++ b/tryton/common/domain_inversion.py @@ -49,11 +49,11 @@ def eval_leaf(part, context, boolop=operator.and_): # In the case where the leaf concerns a m2o then having a value in the # evaluation context is deemed suffisant return bool(context.get(field.split('.')[0])) - if operand == '=' and not context[field] and boolop == operator.and_: + if operand == '=' and not context.get(field) and boolop == operator.and_: # We should consider that other domain inversion will set a correct # value to this field return True - context_field = context[field] + context_field = context.get(field) if isinstance(context_field, datetime.date) and not value: if isinstance(context_field, datetime.datetime): value = datetime.datetime.min diff --git a/tryton/gui/window/view_form/model/record.py b/tryton/gui/window/view_form/model/record.py index 5468943b85..62b3d7f76d 100644 --- a/tryton/gui/window/view_form/model/record.py +++ b/tryton/gui/window/view_form/model/record.py @@ -223,6 +223,8 @@ class Record(SignalEvent): self._check_load() value = {} for name, field in self.group.fields.iteritems(): + if name not in self._loaded and self.id >= 0: + continue value[name] = field.get_eval(self, check_load=check_load) value['id'] = self.id return value @@ -414,7 +416,7 @@ class Record(SignalEvent): else: for field in fields: self[field] - self.validate([]) + self.validate(fields or []) def expr_eval(self, expr, check_load=False): if not isinstance(expr, basestring):