# How to calculate retention Tax, based on Total Tax

Santiago

Hello,

I'm just trying to figure it out how to calculate this Tax, not really sure how to do it, so please let me explain what we need with an example.

When we send an invoice it happens the following:

• Lets say we charge \$100 to a customer for a service (subtotal)
• Then we add the 12% Sales Tax, this will be \$12
• The Total to charge would be \$112. (no issues until here)
• But we have customers, that retain 10% of the tax. (\$1.2)
• If we add a "10% Retain Tax" to our taxes (as -0.10), it will calculate the 10% of the subtotal (\$10), but we need it to calculate the 10% only of the invoice tax total (\$1.2)!

How can we manage this?, I tried with the Tax Type: Python Code, where shows me to calculate as "result = price_unit * 0.10", but I'm not able to find the "tax_subtotal" code or correct formula. Based on the technical guide, I even tried with this:

result = (amount_total - price_subtotal_incl) * 0.10

No luck so far, any idea on how to do it?

Thanks!!

Santiago

Found the solution,

You have to create "Child Taxes", following my example I create this:

• TAX A with 12% of Sale Tax - This is the 12% (0.1200) of the Subtotal.
• TAX A-1 (child of TAX A) with -10% (-0.1000) - This is -10% of Total Tax A.

This will calculate the 12% of Tax of the Subtotal and deduct 10% only from the Invoice Tax Total.

Solved !

For more reference, thanks to this old post, search in the old forum the following:

Multiple child tax issue - http://forum.openerp.com/forum/topic17832.html

1 Comment
Yeison Xiques
-

Hi Santiago. Just to underestand. You were trying to make a withholding on specific tax or on base amount + taxes ? Here in Colombia for example we have to make a withholding VAT of 15% over the input VAT. Just let me know if you have solved this type of withholding.

Tahir Ansari

i need the same functionality in odoo 10. can anyone help me?

gabrielcz