[FIX] exclude function fields from import_compatible export and from all imports

bzr revid: xmo@openerp.com-20111216114941-fr6wsfabxfqf86xw
This commit is contained in:
Xavier Morel 2011-12-16 12:49:41 +01:00
parent c9b93aea94
commit 2989c829f7
2 changed files with 14 additions and 7 deletions

View File

@ -1294,13 +1294,16 @@ class Export(View):
records = []
for field_name, field in fields_sequence:
if import_compat and (exclude and field_name in exclude):
continue
if import_compat and field.get('readonly'):
# If none of the field's states unsets readonly, skip the field
if all(dict(attrs).get('readonly', True)
for attrs in field.get('states', {}).values()):
if import_compat:
if exclude and field_name in exclude:
continue
if 'function' in field:
continue
if field.get('readonly'):
# If none of the field's states unsets readonly, skip the field
if all(dict(attrs).get('readonly', True)
for attrs in field.get('states', {}).values()):
continue
id = prefix + (prefix and '/'or '') + field_name
name = parent_name + (parent_name and '/' or '') + field['string']

View File

@ -111,7 +111,11 @@ openerp.web.DataImport = openerp.web.Dialog.extend({
});
}
_(fields).each(function (field, field_name) {
if (field_name === 'id') { return; }
// Ignore spec for id field
// Don't import function fields (function and related)
if (field_name === 'id' || 'function' in field) {
return;
}
var f = {
id: field_name,
name: field_name,