[FIX] web_kanban: many2many tags only displayed the first time
This bug was a consequence of commit 6c57935 which introduced a JS cache of
stuff like actions, fields_view... The fields_view being modified in place by
the kanban_view (which is obviously not a good practice), it was able to
identify its many2many fields only the first time the view was displayed, as
from the second time, it received an already processed version of the
fields_view in which is wasn't able to identify many2many fields. Thus, those
fields were only displayed the first time the view kanban view was displayed.
This commit is contained in:
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user