[FIX] web: Avoid double-fetching many2many tags in list views
Before this patch, #15920 was happening. The problem was that calling `render_cell` produced a call to [`record.set(column.id + '__display', value)`][1], which triggers the `change` event, which called `render_record` the first time, which called again `render_cell` and produced the 2nd data fetch.
After this patch, `render_record` is only called if there is some place where to put the result, which does not happen in those situations.
There is still the problem that there is one call to name_get for each many2many widget found in a list view (instead of one per full view rendering), but at least they are not two calls!
[1]: 5d17749ff4/addons/web/static/src/js/view_list.js (L1125)
This commit is contained in:
parent
8e7f34c323
commit
5fc3979262
|
@ -977,7 +977,9 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
|
|||
$row = self.$current.children(
|
||||
'[data-id=' + record.get('id') + ']');
|
||||
}
|
||||
$row.replaceWith(self.render_record(record));
|
||||
if ($row.length) {
|
||||
$row.replaceWith(self.render_record(record));
|
||||
}
|
||||
},
|
||||
'add': function (ev, records, record, index) {
|
||||
var $new_row = $(self.render_record(record));
|
||||
|
|
Loading…
Reference in New Issue