Skip to content

Commit

Permalink
[FIX] connector_woocommerce: fix duplicated parents partners and impr…
Browse files Browse the repository at this point in the history
…ove search and error message of partners
  • Loading branch information
FrankC013 committed Oct 17, 2024
1 parent 248403d commit f0674ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion connector_woocommerce/models/sale_order/import_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def payment_method(self, record):
payment_mode = self.backend_record.payment_mode_ids.filtered(
lambda x: record["payment_method"] == x.woocommerce_payment_mode
)
if not payment_mode:
if not payment_mode and record["payment_method"]:
raise ValidationError(
_("Payment method '%s' is not defined on backend")
% record.get("payment_method")
Expand Down
7 changes: 4 additions & 3 deletions connector_woocommerce/models/sale_order/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class WooCommerceSaleOrderImporter(Component):
def _get_partner_parent_domain(self, dir_type, value):
name = value[dir_type].get("company") or value[dir_type].get("name")
return [
("company_type", "=", "company"),
("company_type", "in", (False, "company")),
("child_ids", "!=", False),
("name", "=", name),
]

Expand All @@ -59,10 +60,10 @@ def _get_partner_parent(self, dir_type, value):
**self._additional_partner_parent_fields(value, dir_type),
}
)
value[dir_type]["parent"] = parent.id
elif len(parent) > 1:
raise ValidationError(
_("There are more than one partner with the same name")
_("There are more than one parent partner with the same name %s")
% value[dir_type].get("name")
)
value[dir_type]["parent"] = parent.id

Expand Down

0 comments on commit f0674ab

Please sign in to comment.