# Multiple tax lines for same tax

**URL:** <https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372>\
**Category:** User\
**Tags:** accounting\
**Created:** [October 19, 2020, 9:19am UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372 "2020-10-19T09:19:55Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)\
**Post date:** [October 19, 2020, 9:19am UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372/1 "2020-10-19T09:19:55Z")

</div>

We’ve found that when using the same tax in an invoice and mixing positive and negative amounts the tax lines is duplicated.

Here are some screenshoots that ilustrate the situation:

 ![Two lines with same taxes but diferent sign](https://discuss-cdn.tryton.org/uploads/default/original/2X/e/ed64439c3fa3889433695fea416aaf0820e584c3.png)

 ![Tax lines are duplicated](https://discuss-cdn.tryton.org/uploads/default/original/2X/1/13c569b2921aec5248f4f101821e2e94c46cbeff.png)

As the tax used for the lines is exactly the same I will expect that only a single tax line with the resulting base is created. This is the current behaviour when the lines are for the same sign.

Is there any reason to split the lines depending on the sign or this is a something that should be fixed?

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 19, 2020, 10:40am UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372/2 "2020-10-19T10:40:11Z")

</div>

Because the `_TaxKey` use the base sign as `_key`.  
This is because we allow to distinct in the tax code reporting the types “Invoice” and “Credit” which is a common requirement.

---

<div class="post-metadata">

**Author:** ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)\
**Post date:** [October 19, 2020, 12:02pm UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372/3 "2020-10-19T12:02:17Z")

</div>

> [@ced](#):
>
> This is because we allow to distinct in the tax code reporting the types “Invoice” and “Credit” which is a common requirement.

But and invoice is an “Invoice” or a “Credit Note” not both of them.

If we have a mixed lines in the invoice the sign determines the type of the invoice (at least is what we do for determining the number sequence). So I think the taxes should work the same way.

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 19, 2020, 12:13pm UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372/4 "2020-10-19T12:13:07Z")

</div>

> [@pokoli](#):
>
> But and invoice is an “Invoice” or a “Credit Note” not both of them.

Not the lines, it depends of the sign of the amount.

> [@pokoli](#):
>
> If we have a mixed lines in the invoice the sign determines the type of the invoice (at least is what we do for determining the number sequence).

The numbering does not determine how the line is booked.

> [@pokoli](#):
>
> So I think the taxes should work the same way.

No because it has not sense on an accounting point of view. The invoice document is just a grouping of lines which are credit or debit.

---

<div class="post-metadata">

**Author:** ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)\
**Post date:** [October 19, 2020, 12:33pm UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372/5 "2020-10-19T12:33:22Z")

</div>

> [@ced](#):
>
> > [@pokoli](#):
> >
> > But and invoice is an “Invoice” or a “Credit Note” not both of them.
> 
> Not the lines, it depends of the sign of the amount.

Yes, but the total amount of the invoice not the amount of each line separatly.

> [@ced](#):
>
> No because it has not sense on an accounting point of view. The invoice document is just a grouping of lines which are credit or debit.

On our case the tax uses the same credit and debit account. So there is no diference on accounting balance just a mather of having a single line instead of two.

Indeed our issue is not really linked to the accounting as there is no diference on the behaviour but the problem is that the tax lines are duplicated on the invoice report (and in the UI) which is strange for the end user.

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 19, 2020, 12:35pm UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372/6 "2020-10-19T12:35:56Z")

</div>

> [@pokoli](#):
>
> the total amount of the invoice not the amount of each line separatly.

This has not meaning in accounting.

> [@pokoli](#):
>
> On our case the tax uses the same credit and debit account.

We do not care if the account is the same. It is a credit and a debit.

> [@pokoli](#):
>
> there is no diference on accounting balance

Tax reporting does not care about the balance (otherwise there will be no tax code).

> [@pokoli](#):
>
> the problem is that the tax lines are duplicated on the invoice report (and in the UI) which is strange for the end user.

The user should not care.

---

<div class="post-metadata">

**Author:** ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)\
**Post date:** [October 19, 2020, 12:44pm UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372/7 "2020-10-19T12:44:02Z")

</div>

> [@ced](#):
>
> > [@pokoli](#):
> >
> > the problem is that the tax lines are duplicated on the invoice report (and in the UI) which is strange for the end user.
> 
> The user should not care.

But it cares.

It is strange to have two lines when the user expects a single one.

Indeed the customer receiving the invoice should not take care how we account the taxe amounts. It should only see the amounts that are relevant for him. And this is just:

- The aplicable tax and it’s rate
- The base amount
- The total amount.

Maybe looking on the other way arround is easier to understand the issue:  
If you receive a supplier invoice having _two lines for the same tax_ you will need to sum this up to check that you entered the invoice correctly on the system.

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 19, 2020, 12:46pm UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372/8 "2020-10-19T12:46:32Z")

</div>

Feel free to find a better way to do as long as the reporting is correctly split between credit and debit.

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 19, 2020, 12:54pm UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372/9 "2020-10-19T12:54:31Z")

</div>

> [@pokoli](#):
>
> Indeed the customer receiving the invoice should not take care how we account the taxe amounts.

Yes it should because the credit line should be booked as a credit and the other as debit.

> [@pokoli](#):
>
> It should only see the amounts that are relevant for him.

The base of each debit and credit is relevant.

> [@pokoli](#):
>
> having _two lines for the same tax_

This is not the same tax as there is a credit and a debit.

> [@pokoli](#):
>
> you will need to sum this up to check that you entered the invoice correctly on the system

No because if the system is correct, it will require to have the credit and debit separated.

---

<div class="post-metadata">

**Author:** ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)\
**Post date:** [October 19, 2020, 1:03pm UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372/10 "2020-10-19T13:03:07Z")

</div>

> [@ced](#):
>
> This is not the same tax as there is a credit and a debit.

It is, [this is the tax](https://hg.tryton.org/modules/account_es/file/f11a731a3dc5/tax.xml#l17) I used on the example above

> [@ced](#):
>
> it will require to have the credit and debit separated.

Indeed this is the key of the question. How you will know that it requires credit and debit should be separated? Shouldn’t be this determined by the account/tax code used for reporting?

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 19, 2020, 1:07pm UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372/11 "2020-10-19T13:07:51Z")

</div>

> [@pokoli](#):
>
> It is, [this is the tax](https://hg.tryton.org/modules/account_es/file/f11a731a3dc5/tax.xml#l17) I used on the example above

No it is not, there is a debit and a credit.

> [@pokoli](#):
>
> How you will know that it requires credit and debit should be separated?

We do not need to know as we always separate them following the good accounting practice.

> [@pokoli](#):
>
> Shouldn’t be this determined by the account/tax code used for reporting?

Reporting should not influence how the accounting is done because they are done after and can evolve over time.

---

<div class="post-metadata">

**Author:** ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)\
**Post date:** [October 19, 2020, 9:00pm UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372/12 "2020-10-19T21:00:14Z")

</div>

I’ve beening digging on the [spanish taxes law](https://www.boe.es/buscar/act.php?id=BOE-A-1992-28740) and I just found that in article 78, chapter 3 they talk about what must not be included as tax base:

> 1.º Las cantidades percibidas por razón de indemnizaciones, distintas de las contempladas en el apartado anterior que, por su naturaleza y función, no constituyan contraprestación o compensación de las entregas de bienes o prestaciones de servicios sujetas al impuesto.
> 
> 2.º Los descuentos y bonificaciones que se justifiquen por cualquier medio de prueba admitido en derecho y que se concedan previa o simultáneamente al momento en que la operación se realice y en función de ella.
> 
> Lo dispuesto en el párrafo anterior no será de aplicación cuando las minoraciones de precio constituyan remuneraciones de otras operaciones.
> 
> 3.º Las sumas pagadas en nombre y por cuenta del cliente en virtud de mandato expreso del mismo. El sujeto pasivo vendrá obligado a justificar la cuantía efectiva de tales gastos y no podrá proceder a la deducción del impuesto que eventualmente los hubiera gravado.

In second paragraph they say that the discounts and bonifications (lines with negative amount) that are conceded in the same time as the invoice should not be included as part of base of the tax.

This means that when mixing negative and positive lines, the base of the tax is the diference between both of them. So at least for Spain we should create only a single line.

My initial tought was that we could just use the account to decide if the tax should be splited or not but I’ve seen this behaviour has been added in [Wrong tax base type (#8759) · Issues · Tryton / Tryton · GitLab](https://bugs.tryton.org/issue8759) which does not include any example of the usage but talks about having the same tax and account.

So I’m wondering if it will be good to have some flag on the tax to determine if the same tax and account should be included on the same base line or in diferent ones.

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 19, 2020, 9:27pm UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372/13 "2020-10-19T21:27:08Z")

</div>

> [@pokoli](#):
>
> bonifications (lines with negative amount)

I do not know what you mean by that.

> [@pokoli](#):
>
> This means that when mixing negative and positive lines

This is not a discount. If you want to make a discount change the unit price. This is the point of the `sale_discount` module.  
When you make an invoice like you showed, it means that you are invoicing 10h and you are reimbursing 2h that you previously invoiced.  
If you wanted to make a discount of 20%, you should have to invoice 8h or 10h at 40€.

---

<div class="post-metadata">

**Author:** ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)\
**Post date:** [October 20, 2020, 10:53am UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372/14 "2020-10-20T10:53:24Z")

</div>

> [@ced](#):
>
> This is not a discount. If you want to make a discount change the unit price. This is the point of the `sale_discount` module.  
> When you make an invoice like you showed, it means that you are invoicing 10h and you are reimbursing 2h that you previously invoiced.  
> If you wanted to make a discount of 20%, you should have to invoice 8h or 10h at 40€.

There is the case that you want to make a fixed discount on the invoice. Some examples:

- Early payment discount (if the customer agreed to have a lower maturity date at the invoice it is possible to do the discount directly on the invoices).
- Because we may agree to have a lower price if the invoice exceeds a threshold

Both cases can not be computed updating the unit price of the lines.

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 20, 2020, 11:00am UTC](https://discuss.tryton.org/t/multiple-tax-lines-for-same-tax/3372/15 "2020-10-20T11:00:22Z")

</div>

> [@pokoli](#):
>
> Early payment discount (if the customer agreed to have a lower maturity date at the invoice it is possible to do the discount directly on the invoices).

Such thing do not have a taxes. Usually this goes into a special account and this is not set when the invoice is posted (because you do not know if the customer will be in advance).

> [@pokoli](#):
>
> Because we may agree to have a lower price if the invoice exceeds a threshold

So as you said it is the price that is changed. This is managed by the module `sale_promotion`.
