[FIX]base_import: context was not considered while importing. Thus, default value...
authorDenis Ledoux <dle@openerp.com>
Thu, 31 Oct 2013 13:56:05 +0000 (14:56 +0100)
committerDenis Ledoux <dle@openerp.com>
Thu, 31 Oct 2013 13:56:05 +0000 (14:56 +0100)
lp bug: https://launchpad.net/bugs/1086424 fixed

bzr revid: dle@openerp.com-20131031135605-ffj3tid9prw2mv8z

addons/base_import/static/src/js/import.js

index 3c02933..0c3acd9 100644 (file)
@@ -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