diff options
| author | Lucas Perais (lpe) <lpe@odoo.com> | 2018-05-31 10:06:37 +0200 |
|---|---|---|
| committer | Lucas Perais (lpe) <lpe@odoo.com> | 2018-06-06 09:51:56 +0200 |
| commit | 654ee788d998299679644bf9c5514baddb4bf0b9 (patch) | |
| tree | 8a619ac3bc9929b226a73471149431445a2c400b /addons/web/static/src/js/views/basic | |
| parent | 6ad1a36b6eba2fcfee79641bde56cf6c4180001f (diff) | |
[FIX] web: new record with o2m also with new records prevent name_get
Have a model A with a o2m to B.
In the list have a field B > m2o > C
Also have a sequence field (widget handle) on B
Then Create a record A
Arrange yourself to have two new records B popping right away (through an onchange)
in the o2m. Their C field have to be empty
Resequence those two B lines with the handle
Before this commit, there was a traceback when trying to do an name_get on the C fields
Since both of them are empty, there is no record in the localData
Hence, no model. And also no records anyway, so no need to do a name_get
After this commit, there is no traceback, the name_get is avoided when no data is to be fetched
OPW 1853088
closes #24988
Diffstat (limited to 'addons/web/static/src/js/views/basic')
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_model.js | 7 |
1 files changed, 4 insertions, 3 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 042f7bafa97..da0d58664c2 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -1972,9 +1972,7 @@ var BasicModel = AbstractModel.extend({ var records = []; var ids = []; list = this._applyX2ManyOperations(list); - if (_.isEmpty(list.data)) { - return $.when(); - } + _.each(list.data, function (localId) { var record = self.localData[localId]; var data = record._changes || record.data; @@ -1985,6 +1983,9 @@ var BasicModel = AbstractModel.extend({ ids.push(many2oneRecord.res_id); model = many2oneRecord.model; }); + if (!ids.length) { + return $.when(); + } return this._rpc({ model: model, method: 'name_get', |
