diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-09-30 10:50:41 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-09-30 13:23:53 +0200 |
| commit | 511fd5995c543fe9459a8547ca431432187ea804 (patch) | |
| tree | 4218e356e6b214162eedb0f26bfcc31918a569bd /addons/web/static/src/js/views/basic/basic_model.js | |
| parent | 8d1630a40adbac8f9cd70a8ef0e7b9b61b7a60e8 (diff) | |
[FIX] web: don't discard x2many rows coming from default_get
Problem occured in the MRP Production wizard (with a consumed
product tracked by serial number). The opened record is a new
record, and its one2many has 2 default rows that are prefilled.
If the user edited one of the quantities in those rows, and set
an invalid value instead (e.g. a letter), the row was removed
without notice when it was focused out. This was because the
model wasn't aware that a change has been done on the record,
and as the record was flagged as new, it was simply abandonned.
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 | 11 |
1 files changed, 11 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 8291e798904..377ae7157d3 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -948,6 +948,17 @@ var BasicModel = AbstractModel.extend({ record.fieldsInfo = _.defaults(record.fieldsInfo, viewInfo.fieldsInfo); }, /** + * Manually sets a resource as dirty. This is used to notify that a field + * has been modified, but with an invalid value. In that case, the value is + * not sent to the basic model, but the record should still be flagged as + * dirty so that it isn't discarded without any warning. + * + * @param {string} id a resource id + */ + setDirty: function (id) { + this.localData[id]._isDirty = true; + }, + /** * For list resources, this changes the orderedBy key. * * @param {string} list_id id for the list resource |
