[FIX] web: on editable list save, valid all records
opw-617036: In my current timesheet, if you add a a required field on the timesheet ids lines, and add data in the summary tab, it was possible to validate the timesheet lines while requried fields were missing.
This commit is contained in:
parent
8af9fdfa06
commit
df845940ed
|
@ -3881,28 +3881,23 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
|
||||||
this.o2m.trigger_on_change();
|
this.o2m.trigger_on_change();
|
||||||
},
|
},
|
||||||
is_valid: function () {
|
is_valid: function () {
|
||||||
var editor = this.editor;
|
var self = this;
|
||||||
var form = editor.form;
|
if (!this.editable()){
|
||||||
// If no edition is pending, the listview can not be invalid (?)
|
|
||||||
if (!editor.record) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
// If the form has not been modified, the view can only be valid
|
|
||||||
// NB: is_dirty will also be set on defaults/onchanges/whatever?
|
|
||||||
// oe_form_dirty seems to only be set on actual user actions
|
|
||||||
if (!form.$el.is('.oe_form_dirty')) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
this.o2m._dirty_flag = true;
|
this.o2m._dirty_flag = true;
|
||||||
|
var r;
|
||||||
// Otherwise validate internal form
|
return _.every(this.records.records, function(record){
|
||||||
return _(form.fields).chain()
|
r = record;
|
||||||
.invoke(function () {
|
_.each(self.editor.form.fields, function(field){
|
||||||
this._check_css_flags();
|
field.set_value(r.attributes[field.name]);
|
||||||
return this.is_valid();
|
});
|
||||||
})
|
return _.every(self.editor.form.fields, function(field){
|
||||||
.all(_.identity)
|
field.process_modifiers();
|
||||||
.value();
|
field._check_css_flags();
|
||||||
|
return field.is_valid();
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
do_add_record: function () {
|
do_add_record: function () {
|
||||||
if (this.editable()) {
|
if (this.editable()) {
|
||||||
|
|
Loading…
Reference in New Issue