[FIX] do not display reverse fields of o2ms in import compat
bzr revid: xmo@openerp.com-20111109163232-w9oda8eqo3gyin4q
This commit is contained in:
parent
316e4d3d1c
commit
611705d7f1
|
@ -1193,7 +1193,8 @@ class Export(View):
|
|||
|
||||
@openerpweb.jsonrequest
|
||||
def get_fields(self, req, model, prefix='', parent_name= '',
|
||||
import_compat=True, parent_field_type=None):
|
||||
import_compat=True, parent_field_type=None,
|
||||
exclude=None):
|
||||
|
||||
if import_compat and parent_field_type == "many2one":
|
||||
fields = {}
|
||||
|
@ -1210,6 +1211,8 @@ 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)
|
||||
|
@ -1221,7 +1224,8 @@ class Export(View):
|
|||
record = {'id': id, 'string': name,
|
||||
'value': id, 'children': False,
|
||||
'field_type': field.get('type'),
|
||||
'required': field.get('required')}
|
||||
'required': field.get('required'),
|
||||
'relation_field': field.get('relation_field')}
|
||||
records.append(record)
|
||||
|
||||
if len(name.split('/')) < 3 and 'relation' in field:
|
||||
|
|
|
@ -165,7 +165,11 @@ openerp.web.DataExport = openerp.web.Dialog.extend({
|
|||
}
|
||||
var model = record['params']['model'],
|
||||
prefix = record['params']['prefix'],
|
||||
name = record['params']['name'];
|
||||
name = record['params']['name'],
|
||||
exclude_fields = [];
|
||||
if (record['relation_field']) {
|
||||
exclude_fields.push(record['relation_field']);
|
||||
}
|
||||
|
||||
if (!record.loaded) {
|
||||
var import_comp = self.$element.find("#import_compat").val();
|
||||
|
@ -174,7 +178,8 @@ openerp.web.DataExport = openerp.web.Dialog.extend({
|
|||
prefix: prefix,
|
||||
parent_name: name,
|
||||
import_compat: Boolean(import_comp),
|
||||
parent_field_type : record['field_type']
|
||||
parent_field_type : record['field_type'],
|
||||
exclude: exclude_fields
|
||||
}, function(results) {
|
||||
record.loaded = true;
|
||||
self.on_show_data(results, record.id);
|
||||
|
|
Loading…
Reference in New Issue