Skip to content

Commit

Permalink
T1863 - Cannot create sponsorship for new partner (2/2) (#244)
Browse files Browse the repository at this point in the history
* fixed company_id for recurring contract

* clean
  • Loading branch information
Prazn authored Sep 30, 2024
1 parent fd54121 commit 78b3869
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions recurring_contract/models/recurring_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,11 @@ def on_change_partner_id(self):
else:
self.group_id = False

# Update the company value based on the partner.country_id
# as there is no value for partner.company_id
if self.partner_id.country_id:
# Update the company value based on the partner.company_id
# If there is none, update it based on partner.country_id
if self.partner_id.company_id:
self.company_id = self.partner_id.company_id
elif self.partner_id.country_id:
company_ids = self.env["res.company"].search(
[("partner_id.country_id", "=", self.partner_id.country_id.id)], limit=1
)
Expand Down

0 comments on commit 78b3869

Please sign in to comment.