summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_model.js
diff options
context:
space:
mode:
authorJulien Mougenot <jum@odoo.com>2019-09-27 14:46:35 +0000
committerJulien Mougenot <jum@odoo.com>2019-09-30 12:53:18 +0000
commit652414ca4e42c0f0ece0b70e88a1a74c014b0dcd (patch)
tree6b7eba19117da90b5c6c347545004b620b8a2fa2 /addons/web/static/src/js/views/basic/basic_model.js
parent53bb1387b58937f2b6b84768f59e6982f7847517 (diff)
[FIX] web: grouped list multi edit with m2m
Before this commit, m2m fields were not updated when multi editing in a grouped list. Now, the fields are updated no matter how many levels of groupBys are applied to the list. Part of task 2078807 closes odoo/odoo#37589 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_model.js')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js
index ce8d028d0af..d4e966440cb 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -3356,7 +3356,15 @@ var BasicModel = AbstractModel.extend({
var viewType = view ? view.type : fieldInfo.viewType;
var toFetch = {};
- _.each(list.data, function (dataPoint) {
+
+ // flattens the list.data ids in a grouped case
+ let dataPointIds = list.data;
+ for (let i = 0; i < list.groupedBy.length; i++) {
+ dataPointIds = dataPointIds.reduce((acc, groupId) =>
+ acc.concat(this.localData[groupId].data), []);
+ }
+
+ dataPointIds.forEach(function (dataPoint) {
var record = self.localData[dataPoint];
if (typeof record.data[fieldName] === 'string'){
// in this case, the value is a local ID, which means that the