From 0a5b943d19129545724488f6026632bacd66a97b Mon Sep 17 00:00:00 2001
From: Nicolas Martinelli <nim@odoo.com>
Date: Wed, 11 May 2016 11:54:27 +0200
Subject: [PATCH] [FIX] account: sort taxes before computation

Taxes should be sorted before computation, otherwise if some taxes
affect subsequent taxes, the computation will be wrong.

opw-676119
---
 addons/account/models/account.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/account/models/account.py b/addons/account/models/account.py
index 1b21e3d0c2b3..d0b770c1df96 100644
--- a/addons/account/models/account.py
+++ b/addons/account/models/account.py
@@ -639,7 +639,7 @@ class AccountTax(models.Model):
             prec += 5
         total_excluded = total_included = base = round(price_unit * quantity, prec)
 
-        for tax in self:
+        for tax in self.sorted():
             if tax.amount_type == 'group':
                 ret = tax.children_tax_ids.compute_all(price_unit, currency, quantity, product, partner)
                 total_excluded = ret['total_excluded']
-- 
GitLab