diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 12c39d71a06..6f72d836ea4 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -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: diff --git a/addons/web/static/src/js/data_export.js b/addons/web/static/src/js/data_export.js index 51ac2cbd568..ea142606b5b 100644 --- a/addons/web/static/src/js/data_export.js +++ b/addons/web/static/src/js/data_export.js @@ -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);