From d863d0ff14b9044b4e2d6f71e2aef711546db9d3 Mon Sep 17 00:00:00 2001 From: Raimon Esteve Date: Tue, 16 May 2023 13:22:44 +0200 Subject: [PATCH] Remove include_cancel in taxes_by_invoice report #157246 --- locale/ca.po | 4 --- locale/es.po | 4 --- taxes_by_invoice/messages.pot | 12 ++++----- taxes_by_invoice/taxes_by_invoice.py | 25 +++++++++++++----- .../templates/detail_lines_macro.html | 2 +- taxes_by_invoice/templates/header_macro.html | 6 +++-- .../translations/ca/LC_MESSAGES/messages.mo | Bin 1549 -> 1637 bytes .../translations/ca/LC_MESSAGES/messages.po | 25 +++++++++++------- .../translations/es/LC_MESSAGES/messages.mo | Bin 1563 -> 1657 bytes .../translations/es/LC_MESSAGES/messages.po | 25 +++++++++++------- templates/base.css | 4 +++ view/print_taxes_by_invoice_start_form.xml | 2 -- 12 files changed, 64 insertions(+), 45 deletions(-) diff --git a/locale/ca.po b/locale/ca.po index ee2f3a9..8d699f7 100644 --- a/locale/ca.po +++ b/locale/ca.po @@ -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" diff --git a/locale/es.po b/locale/es.po index 1676ca9..5b85b39 100644 --- a/locale/es.po +++ b/locale/es.po @@ -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" diff --git a/taxes_by_invoice/messages.pot b/taxes_by_invoice/messages.pot index 1f73e9c..cb6a041 100644 --- a/taxes_by_invoice/messages.pot +++ b/taxes_by_invoice/messages.pot @@ -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 \n" "Language-Team: LANGUAGE \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 diff --git a/taxes_by_invoice/taxes_by_invoice.py b/taxes_by_invoice/taxes_by_invoice.py index eb260cb..f3ea5b9 100644 --- a/taxes_by_invoice/taxes_by_invoice.py +++ b/taxes_by_invoice/taxes_by_invoice.py @@ -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, { diff --git a/taxes_by_invoice/templates/detail_lines_macro.html b/taxes_by_invoice/templates/detail_lines_macro.html index a07a1c4..e9bce26 100644 --- a/taxes_by_invoice/templates/detail_lines_macro.html +++ b/taxes_by_invoice/templates/detail_lines_macro.html @@ -1,7 +1,7 @@ {% set nc = namespace(before_invoice_id=None) %} {%for l in record %} {% if nc.before_invoice_id != l.invoice.raw.id %} - + {{ l.invoice.move.render.date }} {{ l.account.render.code}} {{ l.invoice.party.render.rec_name}} diff --git a/taxes_by_invoice/templates/header_macro.html b/taxes_by_invoice/templates/header_macro.html index 613b5ae..c6ddf51 100644 --- a/taxes_by_invoice/templates/header_macro.html +++ b/taxes_by_invoice/templates/header_macro.html @@ -49,8 +49,10 @@ header { {% endif %} - {% if data['parameters']['parties'] %}{{ _('Parties: ') }}{{ data['parameters']['parties']}}{% else %}{{ _('All Parties') }}{% endif %} - {% if data['parameters']['include_cancel'] %}{{ _('This document includes cancelled invoices marked with a *') }}{% else %}{{ _('This document not includes cancelled invoices') }}{% endif %} + {% if data['parameters']['parties'] %}{{ _('Parties: ') }}{{ data['parameters']['parties']}}{% else %}{{ _('All Parties') }}{% endif %} + + + {{ _('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.') }} diff --git a/taxes_by_invoice/translations/ca/LC_MESSAGES/messages.mo b/taxes_by_invoice/translations/ca/LC_MESSAGES/messages.mo index b250f2ff4df30d2eccebbcf0cf0180c95c7e7888..75e208b983d5a8190dc02da31aa788c2064ef111 100644 GIT binary patch delta 756 zcmaLTJ!lj`6u|Mh+=nK)lW>S8DDk0f3lZCw*+>eVX!jVQ0jUOx# z5u0m;YfK<02$EQ)(_oj*#x9kGjsHnj5et{w{q1{i=IxtXZGLO^_u92J#dVVVH1`)D z{B=F9D0PH*6~}R{bbvMDA&%i&e1sp${EZQ%juYQPzc0WO=+O6jfTK$F)e~N-BwpeK zzCJ9dAs!{(EbAZ3`X@X^ei!Swk1hOxO{~+b#}I975IU%lgH zgT!`OxKGzf;$`$Fdr`&%^pn3w-*5~4;Gb~{zal46`{?)mL_a`-hyN#9cm~fRC3O{B ze)8+Q9K+j<;#K8h|C+XeiDMH=WP2_OOe#7tk}kMKOG@Swy(HR(k}bH@$YO+fCR&1n zjnZ{JBQE(TVO=JPiFHQb%(4G>_k-rXs>9INnvTYXHJOfQi=E1wVsB(+taE;@BXgZA zmo67kb^1@(xv>7cI$f#WG->g)KG|p1u1mATSm8IHM5#m)lf9Q4v2-?;d~W@aQPwGcI=`T7yJV`OE?G)eZ G=Y9d6d!pe0 delta 700 zcmaLTPbdUY9Ki9n|NL1?+7Mam9i^1@Cm~5WaC2~R9J3>v*_qfGe~R|trko}>%4H8u z5+w&0N3|Cx2V5lOL{2W7?^~09#WXXY_j@z%_xru~5ZjLB@8aPd!PU%@;JH!3w`(^b zL?!Va)?mT+2*bqZ7{v=eE@A`m6{`Oqu?b&M<%tG`sKz*kgvg5ogL)>U{~?7{#KRvy zh;je>1hz6igM;W|7an2+Z?P8dF@`U=Owkfn5W94%>a1fNw=qn8vClwtR47l75Y=g% zpxRl{kFQbf;00BpH)IDQO7#}3LzSlk)w&*3g-1}G$T+s+436R&cDFG&W56w*c&Qyc zV;z8n*#yr$1AOY1`4vk2h7ksfxyTD71<5 diff --git a/taxes_by_invoice/translations/ca/LC_MESSAGES/messages.po b/taxes_by_invoice/translations/ca/LC_MESSAGES/messages.po index aea6f25..2493b2e 100644 --- a/taxes_by_invoice/translations/ca/LC_MESSAGES/messages.po +++ b/taxes_by_invoice/translations/ca/LC_MESSAGES/messages.po @@ -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 \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" diff --git a/taxes_by_invoice/translations/es/LC_MESSAGES/messages.mo b/taxes_by_invoice/translations/es/LC_MESSAGES/messages.mo index 75ecd7b97d6e068867defc64272aa999f608deed..2d82d122b0d4595a040afc21bb1afebe79707eb6 100644 GIT binary patch delta 774 zcmaLTy=xRf7{~Fs+?|^9B62Y*D)AB9BpA3Yw6zk%(#mGo9nH$#4DQQ?U~!}gh#Hh7 z;9DbhNd$O23oa6S44M_cPBtyU+ag9=3nB2iu*-n&Nke>loKZ zU;OpERa0s=^=;gXYn6|&LA{PGe1SLdb+vzPOsNCZ7tp^K;z4xi=dIwlQUkThqRz%W z+>eij4YiJYs5h(ro2vf~kFx&>oA?bU@H@7#$*?{lI=GAa1}Qsu2Pg3f`rw<~#yMZT zV)2rVE%XDgb32U7=mR~#Blrw`@-6fSen21mGfv}I^#8=K$`+^dg=z|?@Hh$v$Rp|^ zPWZ%^SnR{A<^5WBa8}#UB#DV6wtW|eCKH_+$rjwAWlOH4dP%g6Bwuiuk;NE`T(pEc zFG|n#jkxrm4eN4AO`>z==8pGA(|3mZu8tz#YdZ!Tp2>AGSH7=3Ew{&(TfyvnAoIbQ z?&&hFPyZ={QyX{dCu)Q9I+M#f%!`!8Fo%vyaOOnvJRv57y6&p*V zus(L&qas{nMl-_r?S`EZ_x}f^%OwACVeG7qoP^Gg)T2l<{v@JgMUNah8Gc;(yz!;{ H(LDJZ1_G(0 delta 699 zcmaLTJ4oa}7{Kw_r@FW2$@=7!Wo(5l_I%-^5mY>|6u~lNv+Qb2z)ciU*}}>~EP|C< ziJ+CJjg5_^aD}!$3N38!xaKSr|KsL-6&sTLzHc(~&6jzIZ^Vl?iSWAMYT{|(xl+ly zYcn831^E_!!5!ZN43nQ=3{U<17uJzqpqhV=4fq#TomfzaDokKVh@xmAs9`|*AJSM! z-dCC+2L10N*v$9@_MnR?+{XxB<5#@HIR3#|Hhsb\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" diff --git a/templates/base.css b/templates/base.css index 894659c..9188b74 100644 --- a/templates/base.css +++ b/templates/base.css @@ -165,3 +165,7 @@ tr.bottom { .no-wrap { white-space: nowrap; } + +.grey { + background-color: #f2f2f2; +} diff --git a/view/print_taxes_by_invoice_start_form.xml b/view/print_taxes_by_invoice_start_form.xml index 7512177..2c6b6a2 100644 --- a/view/print_taxes_by_invoice_start_form.xml +++ b/view/print_taxes_by_invoice_start_form.xml @@ -20,8 +20,6 @@ copyright notices and license terms. -->