changeset 4707bb15cc96 in modules/account_es:5.8 details: https://hg.tryton.org/modules/account_es?cmd=changeset&node=4707bb15cc96 description: Do not ignore invoice cancelled by a credit note
issue10030 review348231002 (grafted from 0a742f78ab11d8a45bc583e76058ed3c56c86fab) diffstat: reporting_tax.py | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diffs (31 lines): diff -r 2475ae69e60c -r 4707bb15cc96 reporting_tax.py --- a/reporting_tax.py Fri Apr 02 22:05:48 2021 +0200 +++ b/reporting_tax.py Thu Apr 29 11:20:15 2021 +0200 @@ -434,6 +434,7 @@ invoice = Invoice.__table__() cancel_invoice = Invoice.__table__() move = Move.__table__() + cancel_move = Move.__table__() line = Line.__table__() tax_line = TaxLine.__table__() tax = Tax.__table__() @@ -452,13 +453,15 @@ where=tax_code.aeat_report.in_(cls.excluded_tax_codes()))) where = ((invoice.company == context.get('company')) - & (invoice.state.in_(['posted', 'paid'])) & (tax.es_vat_list_code != Null) & (Extract('year', invoice.invoice_date) == context.get('date', Date.today()).year) - & ~Exists(cancel_invoice.select( - cancel_invoice.cancel_move, distinct=True, - where=(cancel_invoice.cancel_move == invoice.move))) + & ~Exists(cancel_invoice + .join(cancel_move, + condition=cancel_invoice.cancel_move == cancel_move.id) + .select(cancel_invoice.id, distinct=True, + where=((cancel_invoice.id == invoice.id) + & (~cancel_move.origin.like('account.invoice,%'))))) # Use exists to exclude the full invoice when it has multiple taxes & ~Exists(exclude_invoice_tax.select( exclude_invoice_tax.invoice,