Skip to content

Commit

Permalink
[FIX] mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkoNikolovski authored and RUS committed May 25, 2022
1 parent 9a735fe commit b88a725
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions connector_magento/models/partner/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,15 @@ class BaseAddressImportMapper(AbstractComponent):

@mapping
def state(self, record):
if not record.get("region"):
region = record.get("region")
if isinstance(region, dict):
region = region.get("region")

if not region:
return

state = self.env["res.country.state"].search(
[("name", "=ilike", record["region"])], limit=1,
[("name", "=ilike", region)], limit=1,
)
if state:
return {"state_id": state.id}
Expand Down

0 comments on commit b88a725

Please sign in to comment.