diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-06-01 15:09:09 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-06-01 20:45:06 +0200 |
| commit | 1749ac2cd1c29311a1b1a5ab0863529211022434 (patch) | |
| tree | 4dff11936fd765495292c911b988bb6f60e25ff1 /addons/web/static/src/js/views/basic/basic_model.js | |
| parent | 9966e4b333f6f360da7878d087fa226135d8f61d (diff) | |
[FIX] web: allow to unset and reset same many2one value
Suppose that we have a many2one which is set (has a value) in
a form view. Before this rev., if the user unset the value (by
erasing the input content in edit mode), and then reset the same
value, the input remained empty, and the old value wasn't actually
reset.
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 | 7 |
1 files changed, 6 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 16970b2c21b..60abfde4344 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -974,7 +974,12 @@ var BasicModel = AbstractModel.extend({ // user edited a manyone (with the small form view button) with an // onchange. In that case, the onchange is triggered, but the actual // value did not change. - var relatedID = (record._changes && record._changes[fieldName]) || record.data[fieldName]; + var relatedID; + if (record._changes && fieldName in record._changes) { + relatedID = record._changes[fieldName]; + } else { + relatedID = record.data[fieldName]; + } var relatedRecord = this.localData[relatedID]; if (relatedRecord && (data.id === this.localData[relatedID].res_id)) { return $.when(); |
