From 959b0bc720157ce08d904ca7a6cf15b3372e9dff Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 31 Oct 2013 14:56:05 +0100 Subject: [PATCH] [FIX]base_import: context was not considered while importing. Thus, default value (for instance) was not set, and that leaded to inconsistencies (Like importing supplier invoices was actually creating customer invoices lp bug: https://launchpad.net/bugs/1086424 fixed bzr revid: dle@openerp.com-20131031135605-ffj3tid9prw2mv8z --- addons/base_import/static/src/js/import.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/addons/base_import/static/src/js/import.js b/addons/base_import/static/src/js/import.js index 3c029335fb1..0c3acd98265 100644 --- a/addons/base_import/static/src/js/import.js +++ b/addons/base_import/static/src/js/import.js @@ -51,7 +51,12 @@ openerp.base_import = function (instance) { type: 'ir.actions.client', tag: 'import', params: { - model: self.dataset.model + model: self.dataset.model, + // self.dataset.get_context() could be a compound? + // not sure. action's context should be evaluated + // so safer bet. Odd that timezone & al in it + // though + context: self.getParent().action.context, } }, { on_reverse_breadcrumb: function () { @@ -127,6 +132,7 @@ openerp.base_import = function (instance) { var self = this; this._super.apply(this, arguments); this.res_model = action.params.model; + this.parent_context = action.params.context || {}; // import object id this.id = null; this.Import = new instance.web.Model('base_import.import'); @@ -353,11 +359,12 @@ openerp.base_import = function (instance) { }, //- import itself - call_import: function (options) { + call_import: function (kwargs) { var fields = this.$('.oe_import_fields input.oe_import_match_field').map(function (index, el) { return $(el).select2('val') || false; }).get(); - return this.Import.call('do', [this.id, fields, this.import_options()], options) + kwargs.context = this.parent_context; + return this.Import.call('do', [this.id, fields, this.import_options()], kwargs) .then(undefined, function (error, event) { // In case of unexpected exception, convert // "JSON-RPC error" to an import failure, and