From 3e342e2d6f006ad887674922f73306cce6d5352c Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Wed, 15 Jun 2022 15:18:51 +0200 Subject: [PATCH] [FIX] avoid crash when changing a relational field to simple field 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 --- pattern_import_export/models/ir_exports_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pattern_import_export/models/ir_exports_line.py b/pattern_import_export/models/ir_exports_line.py index 20fbc7af..acfd0f70 100644 --- a/pattern_import_export/models/ir_exports_line.py +++ b/pattern_import_export/models/ir_exports_line.py @@ -61,7 +61,7 @@ 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