diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-10-20 10:53:46 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2017-10-20 14:56:37 +0200 |
| commit | 823cfd6ab1b30c0f86acd18e1de98c9bc988594d (patch) | |
| tree | 56ee60d8b2bdfef0c735d5b7d924aaf3df41a5e2 /addons/web/static/src/js/views/basic/basic_model.js | |
| parent | 78dcbdee6e3842dcfd9488fcd926fe2bd9ca6017 (diff) | |
[FIX] web: make sure m2m_checkbox works twice in a row
We had an interesting bug with the field many2many_checkbox: in some
cases, it could cause a crash, because it could not find an element in the
localdata.
To reproduce this, start with a non empty field many2many checkbox, then
uncheck them twice.
The reason is that the datapoint of type 'list' that represents the
current value is actually modified, and the replace_with operation
assumed that it could find the localID by looking into its data. I have
the feeling that a more complete fix is to make sure that the datapoint
is not modified (in its 'data' key), but is modified in its '_changes'
key. However, this would probably be a bigger change.
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.js | 3 |
1 files changed, 3 insertions, 0 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 3591ac3cf94..b4a0b999453 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -1541,6 +1541,9 @@ var BasicModel = AbstractModel.extend({ removedDef = this._applyX2ManyChange(record, fieldName, { operation: 'DELETE', ids: _.map(removedIds, function (resID) { + if (resID in list._cache) { + return list._cache[resID]; + } return _.findWhere(listData, {res_id: resID}).id; }), }); |
