summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-03-31 16:03:46 +0200
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commit28e1620731604410216239fee70a7b1cbfd3b7ae (patch)
treec6b2b598faf224906738efe3960280fcaec33665 /addons/web/static/src/js/views/basic
parent03fabb0c4aefa57ee3a584f45b0af1d64ae01f48 (diff)
[FIX] web: list view did not discard properly
To add a record to a list, the list controller called the addDefaultRecord method. But that method did not made the changes to the _changes key, it edited in place the data key. So, this means that it was not possible to discard the add a line.
Diffstat (limited to 'addons/web/static/src/js/views/basic')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js5
1 files changed, 3 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 e105b78a836..f93635618e3 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -167,10 +167,11 @@ var BasicModel = AbstractModel.extend({
};
return this._makeDefaultRecord(list.model, params).then(function (id) {
list.count++;
+ list._changes = list.data.slice(0);
if (position === 'top') {
- list.data.unshift(id);
+ list._changes.unshift(id);
} else {
- list.data.push(id);
+ list._changes.push(id);
}
return id;
});