diff options
| author | David Monjoie <dmo@odoo.com> | 2017-09-29 14:01:51 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-09-30 15:59:24 +0200 |
| commit | 16eb262c60a3b46f89cb706504a8c2d3dc755e08 (patch) | |
| tree | d721c6e59d22e961c52b4933d4a7982366da7f73 /addons/web/static/src/js/views/basic | |
| parent | e6089545062aa4825d59edd69270f811ed099fb1 (diff) | |
[FIX] web: fix one2many default get
The one2many default get code used to meddle with basic_model's res_ids
manually, which ended up desynchronizing the data and res_ids fields
of the list representation of the one2many values.
This commit solves the issue by using the proper mechanisms of the
basic_model, that is creating a proper datapoint for those ids.
Steps to reproduce the original issue:
- Install sale_mamangement, mrp and purchase
- Create a product
- In the Inventory tab, in Routes, uncheck Buy
- Check and then uncheck back any other route than Buy
- Get a traceback because we are looking for a record with a given
res_id in the list data but since they are desynchronized, data
is empty at that point even though res_ids is not.
Diffstat (limited to 'addons/web/static/src/js/views/basic')
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_model.js | 14 |
1 files changed, 12 insertions, 2 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 7810a1195f0..9e7fb8b78ef 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -3182,8 +3182,18 @@ var BasicModel = AbstractModel.extend({ } if (value[0] === 6) { // REPLACE_WITH - x2manyList.res_ids = value[2]; - x2manyList.count = x2manyList.res_ids.length; + _.each(value[2], function (res_id) { + r = self._makeDataPoint({ + modelName: x2manyList.model, + context: x2manyList.context, + fieldsInfo: fieldsInfo, + fields: fields, + parentID: x2manyList.id, + res_id: res_id, + viewType: viewType, + }); + x2manyList._changes.push({operation: 'ADD', id: r.id}); + }); var def = self._readUngroupedList(x2manyList).then(function () { return $.when( self._fetchX2ManysBatched(x2manyList), |
