From 46e511d1f25f01da02db6fe1b8f2bcc73b44099e Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 9 Jul 2012 13:04:26 +0200 Subject: [PATCH] [FIX] o2m validation workflow for lists, to match new edition methods bzr revid: xmo@openerp.com-20120709110426-w6v512ff5dskmr3x --- addons/web/static/src/js/view_form.js | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 14fa87e5be5..93c6ea103cc 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3156,11 +3156,8 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ })); }, is_valid: function () { - var form; - // A list not being edited is always valid - if (!(form = this.first_edition_form())) { - return true; - } + var form = this.editor.form; + // 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 @@ -3171,25 +3168,12 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ // Otherwise validate internal form return _(form.fields).chain() .invoke(function () { - this._check_css_flag(); + this._check_css_flags(); return this.is_valid(); }) .all(_.identity) .value(); }, - first_edition_form: function () { - var get_form = function (group_or_list) { - if (group_or_list.edition) { - return group_or_list.edition_form; - } - return _(group_or_list.children).chain() - .map(get_form) - .compact() - .first() - .value(); - }; - return get_form(this.groups); - }, do_add_record: function () { if (this.options.editable) { this._super.apply(this, arguments);