Browse Source

[FIX] do not fail if consignes tax group does not exist

pull/2/merge
Thibault Francois 8 years ago
parent
commit
8e6d8c0d94
  1. 3
      beesdoo_product/models/beesdoo_product.py

3
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

Loading…
Cancel
Save