summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_model.js
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-04-06 16:51:26 +0200
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commit64a9398fb385896cafe7725d7361e6131561f606 (patch)
treea05136af244a956c70422f0e9d85407a6f172bc0 /addons/web/static/src/js/views/basic/basic_model.js
parent2bf2976c205573497ab6878dabcbc8e3fde81777 (diff)
[FIX] web: fix corrupt datapoint in basic model
When saving a new record, with the option reload=false, a datapoint in the basic model could be left in a wrong state: the x2many fields were deleted, with all the changes, but the values in the data key were still null, which means that the x2many field has no valid corresponding datapoint, as far as the basicmodel can see. So, with this commit, we make sure to push the changes into the data, so the datapoint is in a proper clean state.
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.js13
1 files changed, 9 insertions, 4 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 d904f8f1ec7..1d511b1eb34 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -640,10 +640,15 @@ var BasicModel = AbstractModel.extend({
record.res_ids.push(id);
record.count++;
}
- // erase changes as they have been applied
- record._changes = {};
-
- return shouldReload ? self._fetchRecord(record) : false;
+ if (shouldReload) {
+ // erase changes as they have been applied
+ record._changes = {};
+ return self._fetchRecord(record);
+ } else {
+ _.extend(record.data, record._changes);
+ record._changes = {};
+ return false;
+ }
});
} else {
return $.when(record_id);