Remove include_cancel in taxes_by_invoice report

#157246
This commit is contained in:
Raimon Esteve 2023-05-16 13:22:44 +02:00
parent b57e741069
commit d863d0ff14
12 changed files with 64 additions and 45 deletions

View File

@ -50,10 +50,6 @@ msgctxt "field:account_reports.print_taxes_by_invoice.start,grouping:"
msgid "Grouping"
msgstr "Agrupació"
msgctxt "field:account_reports.print_taxes_by_invoice.start,include_cancel:"
msgid "Include cancel"
msgstr "Incloure cancel·lats"
msgctxt "field:account_reports.print_taxes_by_invoice.start,output_format:"
msgid "Output Format"
msgstr "Tipus de fitxer"

View File

@ -50,10 +50,6 @@ msgctxt "field:account_reports.print_taxes_by_invoice.start,grouping:"
msgid "Grouping"
msgstr "Agrupación"
msgctxt "field:account_reports.print_taxes_by_invoice.start,include_cancel:"
msgid "Include cancel"
msgstr "Incluir cancelados"
msgctxt "field:account_reports.print_taxes_by_invoice.start,output_format:"
msgid "Output Format"
msgstr "Tipo de fichero"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-04-19 15:23+0200\n"
"POT-Creation-Date: 2023-05-15 15:49+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -97,12 +97,10 @@ msgstr ""
msgid "All Parties"
msgstr ""
#: templates/header_macro.html:43
msgid "This document includes cancelled invoices marked with a *"
msgstr ""
#: templates/header_macro.html:43
msgid "This document not includes cancelled invoices"
#: templates/header_macro.html:45
msgid ""
"Cancelled invoices are shown in gray and those without a cancel move or a"
" cancel move not related to an invoice are not added to the total."
msgstr ""
#: templates/taxes_by_invoice.html:28

View File

@ -91,7 +91,6 @@ class PrintTaxesByInvoiceAndPeriodStart(ModelView):
('group.kind', 'in', ('both', 'purchase'))
)),
], depends=['partner_type'])
include_cancel = fields.Boolean('Include cancel')
@staticmethod
def default_partner_type():
@ -159,7 +158,6 @@ class PrintTaxesByInvoiceAndPeriod(Wizard):
'grouping': self.start.grouping,
'tax_type': self.start.tax_type,
'taxes': [x.id for x in self.start.taxes],
'include_cancel': self.start.include_cancel,
}
return action, data
@ -195,6 +193,7 @@ class TaxesByInvoiceReport(HTMLReport):
FiscalYear = pool.get('account.fiscalyear')
Period = pool.get('account.period')
Party = pool.get('party.party')
Invoice = pool.get('account.invoice')
AccountInvoiceTax = pool.get('account.invoice.tax')
fiscalyear = (FiscalYear(data['fiscalyear']) if data.get('fiscalyear')
@ -251,7 +250,6 @@ class TaxesByInvoiceReport(HTMLReport):
company.party.tax_identifier.code) or ''
parameters['jump_page'] = (True if data['grouping'] == 'invoice'
else False)
parameters['include_cancel'] = data['include_cancel'] or False
parameters['records_found'] = True
domain = [
@ -286,9 +284,6 @@ class TaxesByInvoiceReport(HTMLReport):
if data['taxes']:
domain += [('tax', 'in', data.get('taxes', []))]
if not data['include_cancel']:
domain += [('invoice.state', '!=', 'cancelled')]
records = {}
totals = {
'total_untaxed': _ZERO,
@ -310,7 +305,12 @@ class TaxesByInvoiceReport(HTMLReport):
# If the invoice is cancelled, do not add its values to the
# totals
if data['include_cancel'] and tax.invoice.state == 'cancelled':
if (tax.invoice.state == 'cancelled' and (
(tax.invoice.cancel_move
and tax.invoice.cancel_move.origin
and not isinstance(tax.invoice.cancel_move.origin, Invoice))
or not tax.invoice.cancel_move
or not tax.invoice.cancel_move.origin)):
continue
# With this we have the total for each tax (total base, total
@ -342,6 +342,17 @@ class TaxesByInvoiceReport(HTMLReport):
for tax in taxes:
records.setdefault(tax.tax, []).append(DualRecord(tax))
# If the invoice is cancelled, do not add its values to the
# totals
if (tax.invoice.state == 'cancelled' and (
(tax.invoice.cancel_move
and tax.invoice.cancel_move.origin
and not isinstance(tax.invoice.cancel_move.origin, Invoice))
or not tax.invoice.cancel_move
or not tax.invoice.cancel_move.origin)):
continue
# With this we have the total for each tax (total base, total
# amount and total)
tax_totals.setdefault(tax.tax, {

View File

@ -1,7 +1,7 @@
{% set nc = namespace(before_invoice_id=None) %}
{%for l in record %}
{% if nc.before_invoice_id != l.invoice.raw.id %}
<tr>
<tr class="{% if l.invoice.raw.state == 'cancelled' %}grey{% endif %}">
<td>{{ l.invoice.move.render.date }}</td>
<td>{{ l.account.render.code}}</td>
<td style="text-align: left;">{{ l.invoice.party.render.rec_name}}</td>

View File

@ -49,8 +49,10 @@ header {
</tr>
{% endif %}
<tr>
<td>{% if data['parameters']['parties'] %}{{ _('Parties: ') }}{{ data['parameters']['parties']}}{% else %}{{ _('All Parties') }}{% endif %}</td>
<td style="text-align: right;">{% if data['parameters']['include_cancel'] %}{{ _('This document includes cancelled invoices marked with a *') }}{% else %}{{ _('This document not includes cancelled invoices') }}{% endif %}</td>
<td colspan="2">{% if data['parameters']['parties'] %}{{ _('Parties: ') }}{{ data['parameters']['parties']}}{% else %}{{ _('All Parties') }}{% endif %}</td>
</tr>
<tr>
<td colspan="2"><small>{{ _('Cancelled invoices are shown in gray and those without a cancel move or a cancel move not related to an invoice are not added to the total.') }}</small></td>
</tr>
</tbody>
</table>

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-04-19 15:23+0200\n"
"PO-Revision-Date: 2023-04-19 15:27+0200\n"
"POT-Creation-Date: 2023-05-15 15:49+0200\n"
"PO-Revision-Date: 2023-05-15 15:50+0200\n"
"Last-Translator: \n"
"Language: ca\n"
"Language-Team: ca <LL@li.org>\n"
@ -99,14 +99,21 @@ msgstr "Tercers: "
msgid "All Parties"
msgstr "Tots els tercers"
#: templates/header_macro.html:43
msgid "This document includes cancelled invoices marked with a *"
msgstr "Aquest document inclou factures cancel·lades marcades amb un *"
#: templates/header_macro.html:43
msgid "This document not includes cancelled invoices"
msgstr "Aquest document no inclou factures cancel·lades"
#: templates/header_macro.html:45
msgid ""
"Cancelled invoices are shown in gray and those without a cancel move or "
"a cancel move not related to an invoice are not added to the total."
msgstr ""
"Les factures cancel·lades es mostren en gris i les que no tenen un "
"moviment de cancel·lació, o un moviment de cancel·lació no relacionat "
"amb una factura, no es sumen al total."
#: templates/taxes_by_invoice.html:28
msgid "No records found"
msgstr "No s'han trobat registres"
#~ msgid "This document includes cancelled invoices marked with a *"
#~ msgstr "Aquest document inclou factures cancel·lades marcades amb un *"
#~ msgid "This document not includes cancelled invoices"
#~ msgstr "Aquest document no inclou factures cancel·lades"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-04-19 15:23+0200\n"
"PO-Revision-Date: 2023-04-19 15:27+0200\n"
"POT-Creation-Date: 2023-05-15 15:49+0200\n"
"PO-Revision-Date: 2023-05-15 15:50+0200\n"
"Last-Translator: \n"
"Language: es\n"
"Language-Team: es <LL@li.org>\n"
@ -99,14 +99,21 @@ msgstr "Terceros: "
msgid "All Parties"
msgstr "Todos los terceros"
#: templates/header_macro.html:43
msgid "This document includes cancelled invoices marked with a *"
msgstr "Este documento incluye facturas canceladas marcadas con un *"
#: templates/header_macro.html:43
msgid "This document not includes cancelled invoices"
msgstr "Este documento no incluye facturas canceladas"
#: templates/header_macro.html:45
msgid ""
"Cancelled invoices are shown in gray and those without a cancel move or "
"a cancel move not related to an invoice are not added to the total."
msgstr ""
"Las facturas canceladas se muestran en gris y las que no tienen un "
"movimiento de cancelación, o un movimiento de cancelación no relacionado "
"con una factura, no se suman al total."
#: templates/taxes_by_invoice.html:28
msgid "No records found"
msgstr "No se han encontrado registros"
#~ msgid "This document includes cancelled invoices marked with a *"
#~ msgstr "Este documento incluye facturas canceladas marcadas con un *"
#~ msgid "This document not includes cancelled invoices"
#~ msgstr "Este documento no incluye facturas canceladas"

View File

@ -165,3 +165,7 @@ tr.bottom {
.no-wrap {
white-space: nowrap;
}
.grey {
background-color: #f2f2f2;
}

View File

@ -20,8 +20,6 @@ copyright notices and license terms. -->
<field name="end_date"/>
<label name="totals_only"/>
<field name="totals_only"/>
<label name="include_cancel"/>
<field name="include_cancel"/>
<newline/>
<label id="select_periods" string="Left empty to select all periods"/>
<field name="periods" colspan="4"/>