Skip to content

Commit

Permalink
[16.0][FIX] base_export_manager: Handle id field case
Browse files Browse the repository at this point in the history
id field is a special case. It is named ".id" from the API.

So the name check in base_export_manager fail. We need to handle it
  • Loading branch information
maisim committed Feb 4, 2025
1 parent 87fb61e commit b1c722b
Show file tree
Hide file tree
Showing 2 changed files with 10 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 @@ -177,6 +177,10 @@ def _get_field_id(self, model, name):
:param str name:
Technical name of the field, like ``child_ids``.
"""

# Handle special case "id" field
name = "id" if name == ".id" else name

field = (
self.env["ir.model.fields"]
.sudo()
Expand Down
6 changes: 6 additions & 0 deletions base_export_manager/tests/test_ir_exports_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,9 @@ def test_write_name_same_root(self):
line = self._record_create("name")
# This should end without errors
line.name = "parent_id/name"

def test_field_id_case(self):
# id field is named .id in exports
line = self._record_create(".id")
self.assertEqual(line.field1_id.name, "id")
self.assertEqual(line.name, "id")

0 comments on commit b1c722b

Please sign in to comment.