this.o2m.trigger_on_change();
},
is_valid: function () {
- var editor = this.editor;
- var form = editor.form;
- // 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')) {
+ var self = this;
+ if (!this.editable()){
return true;
}
this.o2m._dirty_flag = true;
-
- // Otherwise validate internal form
- return _(form.fields).chain()
- .invoke(function () {
- this._check_css_flags();
- return this.is_valid();
- })
- .all(_.identity)
- .value();
+ var r;
+ return _.every(this.records.records, function(record){
+ r = record;
+ _.each(self.editor.form.fields, function(field){
+ field.set_value(r.attributes[field.name]);
+ });
+ return _.every(self.editor.form.fields, function(field){
+ field.process_modifiers();
+ field._check_css_flags();
+ return field.is_valid();
+ });
+ });
},
do_add_record: function () {
if (this.editable()) {