Skip to content

Commit

Permalink
[FIX] account: Don't populate invoice lines on not subjected VAT
Browse files Browse the repository at this point in the history
There's a tax in Spanish localization of "VAT not subjected", that
creates this journal items:

1- Expense account: Base amount
2- Expense account: Tax amount
3- AR account: base + tax

In this case, the second line was taken as invoice line, creating a fake
extra move line for it, and also labelling it as "(OLD GROUPED ITEM)".

We avoid both adding the clause of not having a tax_line_id.
  • Loading branch information
pedrobaeza committed Dec 29, 2020
1 parent 0503994 commit a49aaea
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions addons/account/migrations/13.0.1.1/post-migration.py
Expand Up @@ -269,6 +269,7 @@ def migration_invoice_moves(env):
AND ((ail.uom_id IS NULL AND aml.product_uom_id IS NULL) OR ail.uom_id = aml.product_uom_id)
AND ((ail.account_analytic_id IS NULL AND aml.analytic_account_id IS NULL)
OR ail.account_analytic_id = aml.analytic_account_id)
AND aml.tax_line_id IS NULL
AND aml.id NOT IN %s
RETURNING aml.id""", (aml_ids, ),
)
Expand All @@ -288,6 +289,7 @@ def migration_invoice_moves(env):
AND ((ail.uom_id IS NULL AND aml.product_uom_id IS NULL) OR ail.uom_id = aml.product_uom_id)
AND ((ail.account_analytic_id IS NULL AND aml.analytic_account_id IS NULL)
OR ail.account_analytic_id = aml.analytic_account_id)
AND aml.tax_line_id IS NULL
RETURNING aml.id""",
)
aml_ids2 = tuple(x[0] for x in env.cr.fetchall())
Expand All @@ -305,6 +307,7 @@ def migration_invoice_moves(env):
AND ((ail.uom_id IS NULL AND aml.product_uom_id IS NULL) OR ail.uom_id = aml.product_uom_id)
AND ((ail.account_analytic_id IS NULL AND aml.analytic_account_id IS NULL)
OR ail.account_analytic_id = aml.analytic_account_id)
AND aml.tax_line_id IS NULL
AND aml.id IN %s""", (aml_ids2, ),
)
ail_ids = tuple(x[0] for x in env.cr.fetchall())
Expand Down

0 comments on commit a49aaea

Please sign in to comment.