From 8e6d8c0d94d468048bafb7b536d5197ccb4af4c7 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Mon, 6 Jun 2016 17:04:09 +0200 Subject: [PATCH] [FIX] do not fail if consignes tax group does not exist --- beesdoo_product/models/beesdoo_product.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/beesdoo_product/models/beesdoo_product.py b/beesdoo_product/models/beesdoo_product.py index ff67d7b..1e72180 100644 --- a/beesdoo_product/models/beesdoo_product.py +++ b/beesdoo_product/models/beesdoo_product.py @@ -35,7 +35,8 @@ class BeesdooProduct(models.Model): @api.one @api.depends('taxes_id', 'list_price', 'taxes_id.amount', 'taxes_id.tax_group_id', 'total_with_vat', 'display_weight', 'weight') def _get_total(self): - consignes_group = self.env.ref('beesdoo_product.consignes_group_tax') + consignes_group = self.env.ref('beesdoo_product.consignes_group_tax', raise_if_not_found=False) + tax_amount_sum = sum([tax._compute_amount(self.list_price, self.list_price) for tax in self.taxes_id if tax.tax_group_id != consignes_group]) self.total_deposit = sum([tax._compute_amount(self.list_price, self.list_price) for tax in self.taxes_id if tax.tax_group_id == consignes_group]) self.total_with_vat = self.list_price + tax_amount_sum