[FIX] account: sort taxes

In the case of grouped taxes, the taxes would not be applied anymore
after commit 0a5b943d19

opw-678158
opw-678219
This commit is contained in:
Nicolas Martinelli
2016-05-23 12:01:57 +02:00
parent 1139da2884
commit ed2badcd72
+5 -1
View File
@@ -639,7 +639,11 @@ class AccountTax(models.Model):
prec += 5
total_excluded = total_included = base = round(price_unit * quantity, prec)
for tax in self.sorted():
# Sorting key is mandatory in this case. When no key is provided, sorted() will perform a
# search. However, the search method is overridden in account.tax in order to add a domain
# depending on the context. This domain might filter out some taxes from self, e.g. in the
# case of group taxes.
for tax in self.sorted(key=lambda r: r.sequence):
if tax.amount_type == 'group':
ret = tax.children_tax_ids.compute_all(price_unit, currency, quantity, product, partner)
total_excluded = ret['total_excluded']