Do not load validated fields
If the field is not loaded, there is no need to validate it.
This commit is contained in:
+3
-1
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user