[FIX] account: tax mapping logic was broken by 7508b7c
authorOlivier Dony <odo@openerp.com>
Tue, 28 Oct 2014 12:30:26 +0000 (13:30 +0100)
committerOlivier Dony <odo@openerp.com>
Wed, 29 Oct 2014 15:44:55 +0000 (16:44 +0100)
The original tax should not be applied
if at least one destination tax was
applied. It should only be applied if
explicitly included in target taxes.

(Re-)Fixes #2261

addons/account/partner.py

index fa6dd0e..74fbbe1 100644 (file)
@@ -79,11 +79,13 @@ class account_fiscal_position(osv.osv):
     def map_tax(self, taxes):
         result = self.env['account.tax'].browse()
         for tax in taxes:
+            tax_count = 0
             for t in self.tax_ids:
                 if t.tax_src_id == tax:
                     if t.tax_dest_id:
+                        tax_count += 1
                         result |= t.tax_dest_id
-            else:
+            if not tax_count:
                 result |= tax
         return result