diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-07-10 17:02:49 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2017-07-11 14:40:34 +0200 |
| commit | 3d16453865a3ce5cff6323f18a880642a707e011 (patch) | |
| tree | f0b346b99698315730f6bef025a37219ffa89a8c /addons/web/static/src/js/views/basic/basic_model.js | |
| parent | 50dd6bcd4722e100248310264783490e54f44533 (diff) | |
[FIX] web: only send fields present in view in onchange
Before this commit, all x2many fields values were sent to the server in the
onchange call. If a x2many field was not present in the view, then it
was sent as an empty list [], which is totally wrong.
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 | 4 |
1 files changed, 2 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 2f06168fd23..906464a5a26 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -2181,7 +2181,7 @@ var BasicModel = AbstractModel.extend({ var type = record.fields[fieldName].type; var value; if (type === 'one2many' || type === 'many2many') { - if (commands[fieldName].length) { // replace localId by commands + if (commands[fieldName] && commands[fieldName].length) { // replace localId by commands changes[fieldName] = commands[fieldName]; } else { // no command -> no change for that field delete changes[fieldName]; @@ -2256,11 +2256,11 @@ var BasicModel = AbstractModel.extend({ type = fields[fieldName].type; if (type === 'many2many' || type === 'one2many') { - commands[fieldName] = []; if (!data[fieldName]) { // skip if this field is empty continue; } + commands[fieldName] = []; var list = this.localData[data[fieldName]]; if (options.changesOnly && (!list._changes || !list._changes.length)) { // if only changes are requested, skip if there is no change |
