From a83264be8b4093479399261a76c5b9ef5f0cc7e1 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Fri, 28 Aug 2015 19:29:25 +0200 Subject: [PATCH] [FIX] web: handle delete m2m command in list views --- addons/web/static/src/js/views/list_view.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/addons/web/static/src/js/views/list_view.js b/addons/web/static/src/js/views/list_view.js index 5667f19be1f..44ed9ab253c 100644 --- a/addons/web/static/src/js/views/list_view.js +++ b/addons/web/static/src/js/views/list_view.js @@ -1117,12 +1117,14 @@ ListView.List = Class.extend( /** @lends instance.web.ListView.List# */{ var ids; // they come in two shapes: if (value[0] instanceof Array) { - var command = value[0]; - // 1. an array of m2m commands (usually (6, false, ids)) - if (command[0] !== 6) { - throw new Error(_.str.sprintf( _t("Unknown m2m command %s"), command[0])); - } - ids = command[2]; + _.each(value, function(command) { + switch (command[0]) { + case 4: ids.push(command[1]); break; + case 5: ids = []; break; + case 6: ids = command[2]; break; + default: throw new Error(_.str.sprintf( _t("Unknown m2m command %s"), command[0])); + } + }); } else { // 2. an array of ids ids = value;