From 8072751d7f2d10305eac7828a3d6e57d77c531bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 28 Dec 2024 18:50:04 +0100 Subject: [PATCH] Do not load validated fields If the field is not loaded, there is no need to validate it. --- sao/src/model.js | 4 +++- tryton/tryton/gui/window/view_form/model/record.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sao/src/model.js b/sao/src/model.js index 45a47aab55..0bd5e3bd28 100644 --- a/sao/src/model.js +++ b/sao/src/model.js @@ -1326,13 +1326,15 @@ }); }, validate: function(fields, softvalidation, pre_validate) { - this._check_load(fields); var result = true; for (var fname in this.model.fields) { var field = this.model.fields[fname]; if (fields && !~fields.indexOf(fname)) { continue; } + if (!this.get_loaded([fname])) { + continue; + } if (field.description.readonly) { continue; } diff --git a/tryton/tryton/gui/window/view_form/model/record.py b/tryton/tryton/gui/window/view_form/model/record.py index bc360a6f96..a626dc4db1 100644 --- a/tryton/tryton/gui/window/view_form/model/record.py +++ b/tryton/tryton/gui/window/view_form/model/record.py @@ -437,11 +437,12 @@ class Record: return '' def validate(self, fields=None, softvalidation=False, pre_validate=None): - self._check_load(fields) res = True for field_name, field in list(self.group.fields.items()): if fields is not None and field_name not in fields: continue + if not self.get_loaded([field_name]): + continue if field.attrs.get('readonly'): continue if field_name == self.group.exclude_field: