diff --git a/addons/web_kanban/static/src/js/kanban_view.js b/addons/web_kanban/static/src/js/kanban_view.js index e95b97874a4..a7b29235772 100644 --- a/addons/web_kanban/static/src/js/kanban_view.js +++ b/addons/web_kanban/static/src/js/kanban_view.js @@ -73,7 +73,8 @@ var KanbanView = View.extend({ this.grouped_by_m2o = undefined; this.relation = undefined; this.is_empty = undefined; - this.many2manys = []; + // Retrieve many2manys stored in the fields_view if it has already been processed + this.many2manys = this.fields_view.many2manys || []; this.m2m_context = {}; this.widgets = []; this.data = undefined; @@ -95,6 +96,13 @@ var KanbanView = View.extend({ var child = this.fields_view.arch.children[i]; if (child.tag === "templates") { transform_qweb_template(child, this.fields_view, this.many2manys); + // transform_qweb_template(), among other things, identifies and processes the + // many2manys. Unfortunately, it modifies the fields_view in place and, as + // the fields_view is stored in the JS cache, the many2manys are only identified the + // first time the fields_view is processed. We thus store the identified many2manys + // on the fields_view, so that we can retrieve them later. A better fix would be to + // stop modifying shared resources in place. + this.fields_view.many2manys = this.many2manys; this.qweb.add_template(utils.json_node_to_xml(child)); break; } else if (child.tag === 'field') {