Skip to content

Commit

Permalink
[FIX] avoid crash when changing a relational field to simple field
Browse files Browse the repository at this point in the history
Example of crash before this fix : on res.partner, choose country_id as field1_id and code as field2_id then change field1_id for active
name field is not updated yet at the time it goes through _get_last_relation_field so odoo expected a relational field even though it is not anymore it is not anymore
  • Loading branch information
florian-dacosta committed Apr 17, 2024
1 parent 63ac142 commit 7a697c0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pattern_import_export/models/ir_exports_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ def _get_last_relation_field(self, model, path, level=1):
if path:
next_model = self.env[model]._fields[field]._related_comodel_name
next_field = path.split("/", 1)[0]
if self.env[next_model]._fields[next_field]._related_comodel_name:
if (
next_model
and self.env[next_model]._fields[next_field]._related_comodel_name
):
return self._get_last_relation_field(next_model, path, level=level + 1)
return field, model, level

Expand Down

0 comments on commit 7a697c0

Please sign in to comment.