From fbdc2ed9920da0a253f8f292824b976e99d622e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 13 Apr 2011 15:37:15 +0200 Subject: [PATCH] Don't send value for fields that are statically readonly This is important when you don't have write access to a field because it will generate an access error message. --- tryton/gui/window/view_form/model/record.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tryton/gui/window/view_form/model/record.py b/tryton/gui/window/view_form/model/record.py index 8b234a05c4..411356f059 100644 --- a/tryton/gui/window/view_form/model/record.py +++ b/tryton/gui/window/view_form/model/record.py @@ -203,12 +203,16 @@ class Record(SignalEvent): self._check_load() value = [] for name, field in self.group.fields.iteritems(): - if (get_readonly or \ - not field.get_state_attrs(self).get('readonly', False)) \ - and (not get_modifiedonly \ - or field.name in self.modified_fields): - value.append((name, field.get(self, check_load=check_load, - readonly=get_readonly, modified=get_modifiedonly))) + if field.attrs.get('readonly'): + continue + if (field.get_state_attrs(self).get('readonly', False) + and not get_readonly): + continue + if (field.name not in self.modified_fields + and get_modifiedonly): + continue + value.append((name, field.get(self, check_load=check_load, + readonly=get_readonly, modified=get_modifiedonly))) value = dict(value) if includeid: value['id'] = self.id