## Rational

Tax rules are used to manage the Spanish IRPF. This means that self-employees customers have to pay a % of self-employees profits in advance to the Tax Authorities. This is achieved by applying a tax deduction (a tax with negative tax rate) to the original invoice.

For example, if we have an invoice of 100€, with 21% VAT and 15% IRPF reduction it will produce the following amounts:

```
Untaxed Amount: 100 €
VAT Amount: 21 €
IRPF Amount: -15 €
Tax Amount: 6 €
--------------------------
Total Amount: 106 €
```

From: https://groups.google.com/d/msg/tryton/Gc_1ivnZl0U/yQhIfVNTAAAJ

The current tax rule system allows to substitute one tax with another but does not allow to add additional taxes to the current tax (which is the case of the IRPF tax rules). Currently in order to add additional taxes to the current tax the following must be done:

- Create a new tax with two children: 1. The original tax and the new added tax.

Although this works, it makes the number of available taxes unmaintainable as the number of taxes is the product of all IVA taxes per the IRPF taxes.

## Proposal

Add a check on the tax line to preserve the original taxes when applying the tax lines. If this mark is checked, applying the tax rule will return the substitution tax plus the source tax.

## Implentation

https://bugs.tryton.org/issue6721

## Other References

This will probably also make Issue 5121: Allow to modify unit_price on child taxes - Tryton issue tracker no more required, as we required it for an IRPF tax (which had a parent tax due to the tax rule), and this won’t be the case anymore.