For a Tax if "Included in base amount" is ticked. The tax amount for this tax as well as for the child taxes should be added to the base amount for next taxes

Bug #1197278 reported by Tanveer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Account - Invoicing
New
Undecided
Unassigned

Bug Description

For a Tax if "Included in base amount" is ticked, the tax amount for this tax as well as for the child taxes should be added to the base amount for next taxes.

For example assume a product costing 1000 USD
Assuming the following taxes which are applicable on a product:

1. Main Tax One @ 10.3 % applicable on the (Product Value)
2. Main Tax Two @ 2 % applicable on the (Product value + the Main Tax One)

Main Tax One is defined as a Tax of 10% on the Product Value with two children of 1% and 2% applicable on the parent tax
To enable Main Tax Two to be applicable on (Product value + Main Tax One value) we tick the "included in base amount" option for te Main Tax One.

Correct Calculation would be
Base Amount : 1000
Main Tax One (10% of 1000) : 100
Child 1 on Main Tax One (1% of 100) : 1
Child 2 on Main Tax One (2% of 100) : 2

Main Tax Two (2% of 1000+100+1+2) : 22.06

Currenlty in Openerp 7, the child tax values are not included in the base amount passed on by the parent tax.
This leads to wrong calculation as follows:
Main Tax two (2% of 1000 + 100) : 22

Tax amount of Child 1 and Child 2 of Main Tax One are not included in the base amount that is passed on to the Main Tax Two. This is an error.

Turning on the 'included in base amount' for the child taxes is not an option as this leads to error in calculation for the next child item.

I suggest the following patch to account/account.py

--- account.py.original 2013-06-08 04:40:47.000000000 +0530
+++ account.py 2013-07-03 13:27:02.354660013 +0530
@@ -2088,11 +2088,14 @@
                 data['balance'] = cur_price_unit

             amount2 = data.get('amount', 0.0)
+ child_amount_sum=0.0
             if tax.child_ids:
                 if tax.child_depend:
                     latest = res.pop()
                 amount = amount2
                 child_tax = self._unit_compute(cr, uid, tax.child_ids, amount, product, partner, quantity)
+ for ct in child_tax:
+ child_amount_sum+=ct['amount']
                 res.extend(child_tax)
                 if tax.child_depend:
                     for r in res:
@@ -2110,6 +2113,7 @@
                                 latest[name+'_code_id'] = False
             if tax.include_base_amount:
                 cur_price_unit+=amount2
+ cur_price_unit+=child_amount_sum
         return res

     def compute_all(self, cr, uid, taxes, price_unit, quantity, product=None, partner=None, force_excluded=False):

I have already read Bug No. 667920. This seems similar but is not same.

Revision history for this message
Tanveer (tanveer-singh) wrote :

--- account.py.original 2013-06-08 04:40:47.000000000 +0530
+++ account.py 2013-07-03 13:27:02.354660013 +0530
@@ -2088,11 +2088,14 @@
                 data['balance'] = cur_price_unit

             amount2 = data.get('amount', 0.0)
+ child_amount_sum=0.0
             if tax.child_ids:
                 if tax.child_depend:
                     latest = res.pop()
                 amount = amount2
                 child_tax = self._unit_compute(cr, uid, tax.child_ids, amount, product, partner, quantity)
+ for ct in child_tax:
+ child_amount_sum+=ct['amount']
                 res.extend(child_tax)
                 if tax.child_depend:
                     for r in res:
@@ -2110,6 +2113,7 @@
                                 latest[name+'_code_id'] = False
             if tax.include_base_amount:
                 cur_price_unit+=amount2
+ cur_price_unit+=child_amount_sum
         return res

     def compute_all(self, cr, uid, taxes, price_unit, quantity, product=None, partner=None, force_excluded=False):

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.