From deacfec02195d7a0db88139f170597ad0ea1b058 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Thu, 29 Sep 2016 18:10:17 +0200 Subject: [PATCH] [FIX][web] Stop recursively adding contexts. Some lines below this patch, there is this: if (action.context) { c.add(action.context); } action.context = c; Since the `action` variable was coming by reference, this means that each time you press a button, it added its context to itself, making that after pressing too many times the same button, recursiveness turned the system slow. Also, a bigger side effect of this is that if you had a one2many tree view with a button on it that had a context like `{'default_other': some_field}`, the context was not being updated when you clicked on a different row. With this patch, further modifications on the action are made on a copy, so no recursion happens and the original action is kept intact. --- addons/web/static/src/js/views/list_view.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/web/static/src/js/views/list_view.js b/addons/web/static/src/js/views/list_view.js index 615db42e6b85b..0360d55f173a8 100644 --- a/addons/web/static/src/js/views/list_view.js +++ b/addons/web/static/src/js/views/list_view.js @@ -13,6 +13,7 @@ var session = require('web.session'); var Sidebar = require('web.Sidebar'); var utils = require('web.utils'); var View = require('web.View'); +var $ = require('$'); var Class = core.Class; var _t = core._t; @@ -713,6 +714,7 @@ var ListView = View.extend( /** @lends instance.web.ListView# */ { return field.name === name; }); if (!action) { return; } + action = $.extend(true, {}, action); if ('confirm' in action && !window.confirm(action.confirm)) { return; }