From f007a2ce6a619bf99c3a180fa72b7810231bd0e3 Mon Sep 17 00:00:00 2001 From: Dorin Hongu Date: Fri, 17 Jan 2025 11:28:35 +0200 Subject: [PATCH] Make partner_generic reference fail gracefully if not found Updated the code to handle the case where the generic partner reference is missing by adding `raise_if_not_found=False`. This ensures the process does not crash and improves robustness in scenarios where the reference is unavailable. --- deltatech_expenses/models/deltatech_expenses_deduction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deltatech_expenses/models/deltatech_expenses_deduction.py b/deltatech_expenses/models/deltatech_expenses_deduction.py index 176f882e7..259ae919e 100644 --- a/deltatech_expenses/models/deltatech_expenses_deduction.py +++ b/deltatech_expenses/models/deltatech_expenses_deduction.py @@ -325,7 +325,7 @@ def validate_expenses(self): purchase_journal = self.env["account.journal"].search(domain, limit=1) partner_generic = self.company_id.generic_partner_id if not partner_generic: - partner_generic = self.env.ref("deltatech_partner_generic.partner_generic") + partner_generic = self.env.ref("deltatech_partner_generic.partner_generic", raise_if_not_found=False) for expenses in self: name = expenses.number