Manage exclude_field as group attribute

We can not rely on the screen linked to the group to provide this information
because if the group is the value of a One2Many inside a One2Many, the screen
is shared between multiple records and so only one record is linked to the
screen. So when the top record is validated all the records not linked to the
screen may be considered invalid because the exclude_field will not be
excluded from the validation.

issue7715
review46651002
This commit is contained in:
Cédric Krier committed 2018-09-28 17:21:35 +02:00
1 parent 2a65852006
commit e72445bf9d
2 files changed
+6 -7

No files matched your search

+5 -7
View File
@@ -92,6 +92,7 @@
array.record_removed = [];
array.record_deleted = [];
array.__readonly = false;
array.exclude_field = null;
array.skip_model_access = false;
array.forEach(function(e, i, a) {
e.group = a;
@@ -884,6 +885,9 @@
if (!(fname in this.model.fields)) {
continue;
}
if (fname == this.group.exclude_field) {
continue;
}
if ((this.model.fields[fname] instanceof Sao.field.Many2One) ||
(this.model.fields[fname] instanceof Sao.field.Reference)) {
var field_rec_name = fname + '.rec_name';
@@ -1150,12 +1154,6 @@
validate: function(fields, softvalidation, pre_validate, sync) {
var validate_fields = function() {
var result = true;
var exclude_fields = [];
this.group.screens.forEach(function(screen) {
if (screen.exclude_field) {
exclude_fields.push(screen.exclude_field);
}
});
for (var fname in this.model.fields) {
// Skip not loaded fields if sync and record is not new
if (sync && this.id >= 0 && !(fname in this._loaded)) {
@@ -1171,7 +1169,7 @@
if (field.description.readonly) {
continue;
}
if (~exclude_fields.indexOf(fname)) {
if (fname == this.group.exclude_field) {
continue;
}
if (!field.validate(this, softvalidation, pre_validate)) {
+1
View File
@@ -1043,6 +1043,7 @@
var views = fields_views[name];
views.forEach(views_add);
}
this.group.exclude_field = this.exclude_field;
},
new_group: function(context) {
if (!context) {