diff options
| author | Xavier Morel <xmo@openerp.com> | 2011-10-18 12:21:08 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@openerp.com> | 2011-10-18 12:21:08 +0200 |
| commit | 47d4fa6d7d5728f6ddda1f713f47cd9d2a93eaf7 (patch) | |
| tree | 5a6dbd99105d82bce26382f0086321e8d5defb56 /addons/web/static/src/js/data_import.js | |
| parent | c736d4a773edaf3ac4cd4d779c9bfe0254a0f3c1 (diff) | |
| parent | 19f265f11b600c1971c87e6b805d7ed12aeaebf4 (diff) | |
[FIX] columns with default values should not be marked as required during import
bzr revid: xmo@openerp.com-20111018102108-2c1uixgbeb3t6wkx
Diffstat (limited to 'addons/web/static/src/js/data_import.js')
| -rw-r--r-- | addons/web/static/src/js/data_import.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/addons/web/static/src/js/data_import.js b/addons/web/static/src/js/data_import.js index 9c686846751..0864c5e594e 100644 --- a/addons/web/static/src/js/data_import.js +++ b/addons/web/static/src/js/data_import.js @@ -37,6 +37,7 @@ openerp.web.DataImport = openerp.web.Dialog.extend({ this.model = parent.model; this.fields = []; this.all_fields = []; + this.fields_with_defaults = []; this.required_fields = null; var convert_fields = function (root, prefix) { @@ -50,7 +51,9 @@ openerp.web.DataImport = openerp.web.Dialog.extend({ }; this.ready = $.Deferred.queue().then(function () { self.required_fields = _(self.fields).chain() - .filter(function (field) { return field.required; }) + .filter(function (field) { + return field.required && + !_.include(self.fields_with_defaults, field.id); }) .pluck('name') .value(); convert_fields(self); @@ -82,7 +85,16 @@ openerp.web.DataImport = openerp.web.Dialog.extend({ this.ready.push(new openerp.web.DataSet(this, this.model).call( 'fields_get', [], function (fields) { self.graft_fields(fields); - })); + self.ready.push(new openerp.web.DataSet(self, self.model) + .default_get(_.pluck(self.fields, 'id'), function (fields) { + _.each(fields, function(val, key) { + if (val) { + self.fields_with_defaults.push(key); + } + }); + }) + ) + })); }, graft_fields: function (fields, parent, level) { parent = parent || this; |
