Skip to content

Commit

Permalink
Make partner_generic reference fail gracefully if not found
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dhongu committed Jan 17, 2025
1 parent 04bf431 commit f007a2c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion deltatech_expenses/models/deltatech_expenses_deduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f007a2c

Please sign in to comment.