[FIX] web: avoid trying to access to deleted record message when change password
authorMartin Trigaux <mat@openerp.com>
Thu, 24 Jul 2014 10:12:33 +0000 (12:12 +0200)
committerMartin Trigaux <mat@openerp.com>
Thu, 24 Jul 2014 10:12:33 +0000 (12:12 +0200)
The onchange call can be made with empty ids list (which would fail). opw 610810

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

index 5767ffe..46537a2 100644 (file)
@@ -504,8 +504,10 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
                     // In case of a o2m virtual id, we should pass an empty ids list
                     ids.push(self.datarecord.id);
                 }
-                def = self.alive(new instance.web.Model(self.dataset.model).call(
-                    "onchange", [ids, values, trigger_field_name, onchange_specs, context]));
+                if (ids.length) {
+                    def = self.alive(new instance.web.Model(self.dataset.model).call(
+                        "onchange", [ids, values, trigger_field_name, onchange_specs, context]));
+                }
             }
             return def.then(function(response) {
                 if (widget && widget.field['change_default']) {