Skip to content

Commit

Permalink
[FIX] connector_extension: wrap record throws an error because don't …
Browse files Browse the repository at this point in the history
…have a record to ensure_one.
  • Loading branch information
KNVx authored and eantones committed May 21, 2024
1 parent 891bd1f commit b41cb76
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions connector_extension/components/binder.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,17 +352,17 @@ def wrap_record(self, relation):
:return: binding corresponding to the real record or
empty recordset if the record has no binding
"""
if isinstance(relation, models.BaseModel):
relation.ensure_one()
else:
if not isinstance(relation, models.BaseModel):
if not isinstance(relation, int):
raise InvalidDataError(
"The real record (relation) must be a "
"regular Odoo record or an id (integer)"
)
relation = self.model.browse(relation)
if not relation:
raise InvalidDataError("The real record (relation) does not exist")
relation = self.model.browse(relation).exists()
if not relation:
raise InvalidDataError("The real record (relation) does not exist")

relation.ensure_one()

if self.model._name == relation._name:
raise Exception(
Expand Down

0 comments on commit b41cb76

Please sign in to comment.