diff --git a/recurring_contract/models/recurring_contract.py b/recurring_contract/models/recurring_contract.py index 17dcb984..61d6d2ee 100644 --- a/recurring_contract/models/recurring_contract.py +++ b/recurring_contract/models/recurring_contract.py @@ -415,9 +415,10 @@ def on_change_partner_id(self): company_ids = self.env["res.company"].search( [("partner_id.country_id", "=", self.partner_id.country_id.id)], limit=1 ) - self.company_id = company_ids.filtered( - lambda company: company.country_id == self.partner_id.country_id - ) + if company_ids: + self.company_id = company_ids.filtered( + lambda company: company.country_id == self.partner_id.country_id + ) @api.onchange("company_id") def on_change_company_id(self):