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
This commit is contained in:
Xavier Morel
2012-02-16 17:31:55 +01:00
parent a747ff55dd
commit 56562531ab
+11 -1
View File
@@ -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,