summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2018-04-04 13:28:35 +0200
committerNicolas Martinelli <nim-odoo@users.noreply.github.com>2018-04-05 10:12:06 +0200
commit6397ce7eb0c4ad912259ab6d6ee3a9fbf16d0c64 (patch)
tree7baecd64fc63e4bbe68936d78539fdf928f20631 /addons/web/static/src/js/views/basic
parent64ef2b396b46162cf13d3e89b0015cea7e78744b (diff)
[FIX] web: loss of context when duplicating
- Create a vendor bill, save and validate - Duplicate the bill, save - Click on "Create" A customer invoice is created, while the user expects a vendor bill. After duplication, the new record is loaded but the context is lost. Since the default value for the invoice type is based on the context key `type`, a loss of context leads to an incorrect invoice type. opw-1826453 Co-authored-by: Géry Debongnie <ged@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/views/basic')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js4
1 files changed, 3 insertions, 1 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 11e2347eba7..d7d91a65405 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -375,11 +375,12 @@ var BasicModel = AbstractModel.extend({
duplicateRecord: function (recordID) {
var self = this;
var record = this.localData[recordID];
+ var context = this._getContext(record);
return this._rpc({
model: record.model,
method: 'copy',
args: [record.data.id],
- context: this._getContext(record),
+ context: context,
})
.then(function (res_id) {
var index = record.res_ids.indexOf(record.res_id);
@@ -391,6 +392,7 @@ var BasicModel = AbstractModel.extend({
res_id: res_id,
res_ids: record.res_ids.slice(0),
viewType: record.viewType,
+ context: context,
});
});
},