summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/data_import.js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-02-16 17:31:55 +0100
committerXavier Morel <xmo@openerp.com>2012-02-16 17:31:55 +0100
commit56562531ab08efd63069b78bdb9f2bde0de8053c (patch)
tree32d88f8aa66f8989d5f588aad3c4d240a14236f2 /addons/web/static/src/js/data_import.js
parenta747ff55dd1c85fd1d3b920e5e20131473471a4a (diff)
[FIX] xmo@openerp.com-20120209090214-84d6jjr1jnf32kpi excluded too many fields
previous change would exclude all fields with @readonly, but @state can remove @readonly from fields and means fields are importable again (pretty much). Need to add that, otherwise it's almost impossible to import stuff bzr revid: xmo@openerp.com-20120216163155-wh8uory00i2qifxy
Diffstat (limited to 'addons/web/static/src/js/data_import.js')
-rw-r--r--addons/web/static/src/js/data_import.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/addons/web/static/src/js/data_import.js b/addons/web/static/src/js/data_import.js
index 4bcdd4dd1df..83eea2cccbb 100644
--- a/addons/web/static/src/js/data_import.js
+++ b/addons/web/static/src/js/data_import.js
@@ -109,9 +109,19 @@ openerp.web.DataImport = openerp.web.Dialog.extend({
_(fields).each(function (field, field_name) {
// Ignore spec for id field
// Don't import function fields (function and related)
- if (field_name === 'id' || field.readonly) {
+ if (field_name === 'id') {
return;
}
+ // Skip if there's no state which could disable @readonly,
+ // if a field is ever always readonly we can't import it
+ if (field.readonly) {
+ // no states at all
+ if (_.isEmpty(field.states)) { return; }
+ // no state altering @readonly
+ if (!_.any(field.states, function (modifiers) {
+ return _(modifiers).chain().pluck(0).contains('readonly').value();
+ })) { return; }
+ }
var f = {
id: field_name,