Skip to content

Commit

Permalink
[FIX][14.0] base_export_manager: manage
Browse files Browse the repository at this point in the history
while exporting data, (could be before installing this module), if user
request for postgresql id, we can get some entries likes
,  in ir.exports.line.

We should be able to handle such existing lines
  • Loading branch information
petrus-v committed Mar 16, 2023
1 parent e6823a6 commit 9c662d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions base_export_manager/models/ir_exports_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ def _inverse_name(self):
one.with_context(skip_check=True)[one.field_n(num, True)] = False
continue
field_name = parts[num - 1]
# Odoo make difference between bank_ids/.id and bank_ids/id, the
# former refer to xml id the second the postgresql id column
# here we want to find the id field is user request for `.id`
field_name = field_name.replace(".id", "id")
model = one.model_n(num)
# You could get to failing constraint while populating the
# fields, so we skip the uniqueness check and manually check
Expand Down
2 changes: 2 additions & 0 deletions base_export_manager/tests/test_ir_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ def test_create_with_basic_data(self):
"name": "Test éxport",
"resource": "ir.exports",
"export_fields": [
[0, 0, {"name": ".id"}],
[0, 0, {"name": "export_fields"}],
[0, 0, {"name": "export_fields/create_uid"}],
[0, 0, {"name": "export_fields/create_date"}],
[0, 0, {"name": "export_fields/field1_id"}],
[0, 0, {"name": "export_fields/field1_id/.id"}],
],
}
virt_record = self.env["ir.exports"].new(data)
Expand Down

0 comments on commit 9c662d5

Please sign in to comment.