[FIX] correctly check for o2m listview validity
authorXavier Morel <xmo@openerp.com>
Tue, 12 Mar 2013 11:22:44 +0000 (12:22 +0100)
committerXavier Morel <xmo@openerp.com>
Tue, 12 Mar 2013 11:22:44 +0000 (12:22 +0100)
if an edition has been canceled, don't check the form's content as it
does not matter.

lp bug: https://launchpad.net/bugs/1103507 fixed

bzr revid: xmo@openerp.com-20130312112244-zmt34jydpzge6yof

addons/web/static/src/js/view_form.js

index 645b017..80abcc0 100644 (file)
@@ -3785,8 +3785,12 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
         this.o2m.trigger_on_change();
     },
     is_valid: function () {
-        var form = this.editor.form;
-
+        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