Skip to content

Commit

Permalink
[FIX] product_analytic_purchase: Check if analytic account is filled in
Browse files Browse the repository at this point in the history
  • Loading branch information
rousseldenis committed Nov 16, 2023
1 parent f609311 commit 73b94a5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion product_analytic_purchase/models/purchase_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ def create(self, vals_list):
product = self.env["product.product"].browse(vals.get("product_id"))
ana_accounts = product.product_tmpl_id._get_product_analytic_accounts()
ana_account = ana_accounts["expense"]
vals["analytic_distribution"] = {ana_account.id: 100.0}
vals["analytic_distribution"] = (
{ana_account.id: 100.0} if ana_account else False
)
return super().create(vals_list)

0 comments on commit 73b94a5

Please sign in to comment.