Skip to content

Commit

Permalink
Merge PR #768 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by simahawk
  • Loading branch information
OCA-git-bot committed Sep 6, 2023
2 parents 3fcfa79 + db864b0 commit cea43d8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions base_business_document_import/models/business_document_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,8 @@ def _match_partner( # noqa: C901
partner = self._direct_match(partner_dict, rpo, raise_exception=raise_exception)
if partner:
return partner
company_id = self._context.get("force_company") or self.env.company.id
domain = domain or []
domain += ["|", ("company_id", "=", False), ("company_id", "=", company_id)]
domain += self._match_company_domain()
order = self._get_match_partner_order(partner_type)
partner_type_label = self._get_match_partner_type_label(partner_type)
partner_dict["type"] = partner_type
Expand Down Expand Up @@ -506,12 +505,9 @@ def _match_partner_bank(
_("IBAN <b>%s</b> is not valid, so it has been ignored.") % iban
)
return False
company_id = self._context.get("force_company") or self.env.company.id
bankaccount = rpbo.search(
[
"|",
("company_id", "=", False),
("company_id", "=", company_id),
self._match_company_domain()
+ [
("sanitized_acc_number", "=", iban),
("partner_id", "=", partner.id),
],
Expand Down Expand Up @@ -640,7 +636,7 @@ def _match_product_search(self, product_dict):

@api.model
def _match_company_domain(self):
company_id = self._context.get("force_company") or self.env.user.company_id.id
company_id = self._context.get("force_company") or self.env.company.id
return ["|", ("company_id", "=", False), ("company_id", "=", company_id)]

@api.model
Expand Down

0 comments on commit cea43d8

Please sign in to comment.