From 8b41906bf8a22e3f00d3ea334f89b7f1aec27442 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 24 Jul 2014 12:12:33 +0200 Subject: [PATCH] [FIX] web: avoid trying to access to deleted record message when change password The onchange call can be made with empty ids list (which would fail). opw 610810 --- addons/web/static/src/js/view_form.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 5767ffe5489..46537a2fe4e 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -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']) {