Skip to content

Commit df88b1e

Browse files
committed
[WIP] l10n_do: cleaning report_invoice
1 parent 3195a20 commit df88b1e

File tree

2 files changed

+46
-71
lines changed

2 files changed

+46
-71
lines changed

addons/l10n_do/models/account_move.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,11 @@ def _get_l10n_do_amounts(self, company_currency=False):
218218

219219
def _get_name_invoice_report(self):
220220
self.ensure_one()
221-
if self.l10n_latam_use_documents and self.country_code == "DO":
222-
return "l10n_do.report_invoice_document_inherited"
221+
if (
222+
self.l10n_latam_use_documents
223+
and self.company_id.account_fiscal_country_id.code == "DO"
224+
):
225+
return "l10n_do.report_invoice_document"
223226
return super()._get_name_invoice_report()
224227

225228
@api.constrains("move_type", "l10n_latam_document_type_id")

addons/l10n_do/views/report_invoice.xml

Lines changed: 41 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
<span t-field="o.invoice_date"/>
3737
</span>
3838
<br/>
39-
<span t-if="o.invoice_date_due and o.move_type == 'out_invoice' and o.state == 'posted' and not ecf_representation">
39+
<span
40+
t-if="o.invoice_date_due and o.move_type == 'out_invoice' and o.state == 'posted'">
4041
<strong>Vence:</strong>
4142
<span t-field="o.invoice_date_due"/>
4243
</span>
@@ -47,33 +48,24 @@
4748
<h2>
4849
<span t-field="o.l10n_latam_document_type_id.report_name"/>
4950
</h2>
50-
<strong t-if="o.l10n_do_fiscal_number">
51-
<t t-if="ecf_representation">e-NCF:</t>
52-
<t t-else="">NCF:</t>
51+
<strong t-if="o.l10n_latam_document_number">
52+
<t>NCF:</t>
5353
</strong>
54-
<span t-field="o.l10n_do_fiscal_number"/>
54+
<span t-field="o.l10n_latam_document_number"/>
5555
<br/>
56-
<span t-if="(o.move_type == 'out_refund' or o.move_type == 'in_refund' or o.debit_origin_id) and (o.l10n_do_origin_ncf != False)">
56+
<span
57+
t-if="(o.move_type == 'out_refund' or o.move_type == 'in_refund' or o.debit_origin_id) and o.reversed_entry_id">
5758
<strong>NCF modificado:</strong>
58-
<span t-field="o.l10n_do_origin_ncf"/>
59-
<t t-if="ecf_representation">
60-
<br/>
61-
<strong>Código Modificación:</strong>
62-
<span t-field="o.l10n_do_ecf_modification_code"/>
63-
</t>
59+
<span t-field="o.reversed_entry_id.l10n_latam_document_number"/>
6460
<br/>
6561
</span>
6662
<span id="fiscal_exp_date"
6763
t-if="o.l10n_latam_use_documents
68-
and o.move_type in ['out_invoice', 'out_refund']
64+
and o.is_sale_document()
6965
and o.state == 'posted'
70-
and o.l10n_do_fiscal_number
66+
and o.l10n_latam_document_number
7167
and o.l10n_latam_document_type_id
7268
and o.l10n_latam_document_type_id.doc_code_prefix[1:] not in ('32', '34', '02')">
73-
<strong>
74-
<t t-if="ecf_representation">Vencimiento e-NCF:</t>
75-
<t t-else="">Válida hasta:</t>
76-
</strong>
7769
<span id="ecf_exp_date"
7870
t-field="o.l10n_do_ncf_expiration_date"/>
7971
</span>
@@ -89,7 +81,7 @@
8981
<t t-elif="vat_len == 11">Cédula:</t>
9082
<t t-else="">ID Cliente:</t>
9183
</strong>
92-
<span class="m-0" t-esc="o.commercial_partner_id.vat or ''"/>
84+
<span class="m-0" t-out="o.commercial_partner_id.vat or ''"/>
9385
<br/>
9486
<strong>
9587
<t t-if="vat_len == 9">Razón Social:</t>
@@ -154,13 +146,13 @@
154146
<t t-foreach="tax_totals['subtotals']" t-as="subtotal">
155147
<tr class="border-black o_subtotal">
156148
<td>
157-
<strong t-esc="subtotal['name']"/>
149+
<strong t-out="subtotal['name']"/>
158150
</td>
159151

160152
<td class="text-right">
161153
<span
162154
t-att-class="oe_subtotal_footer_separator"
163-
t-esc="subtotal['formatted_amount']"
155+
t-out="subtotal['formatted_amount']"
164156
/>
165157
</td>
166158
</tr>
@@ -174,26 +166,28 @@
174166
<t>
175167
<td>
176168
<span class="text-nowrap"
177-
t-esc="tax_aml.tax_line_id.description"/>
169+
t-out="tax_aml.tax_line_id.invoice_label"/>
178170
</td>
179171
<td class="text-right o_price_total">
180-
<span class="text-nowrap" t-esc="l10n_do_tax_amount"
172+
<span class="text-nowrap" t-out="l10n_do_tax_amount"
181173
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
182174
</td>
183175
</t>
184176
</tr>
185177
</t>
186178

187-
<t t-set="total_amount_taxed" t-value="l10n_do_amounts['itbis_taxable_amount']"/>
188-
<t t-set="total_exempt_amount" t-value="l10n_do_amounts['itbis_exempt_amount']"/>
179+
<t t-set="total_amount_taxed"
180+
t-value="l10n_do_amounts['itbis_taxable_amount']"/>
181+
<t t-set="total_exempt_amount"
182+
t-value="l10n_do_amounts['itbis_exempt_amount']"/>
189183

190184
<tr class="border-black o_total" t-if="ecf_representation">
191185
<td>Monto Gravado</td>
192186
<td class="text-right o_price_total">
193187
<!-- MontoGravadoTotal consiste en la suma de la base imponible de todas las lineas gravadas con ITBIS -->
194188
<span class="text-nowrap"
195189
t-options='{"widget": "monetary", "display_currency": o.currency_id}'
196-
t-esc="total_amount_taxed"/>
190+
t-out="total_amount_taxed"/>
197191
</td>
198192
</tr>
199193
<tr t-if="ecf_representation">
@@ -202,7 +196,7 @@
202196
<!-- MontoExento consiste en la suma de la base imponible de todas las lineas exentas -->
203197
<span class="text-nowrap"
204198
t-options='{"widget": "monetary", "display_currency": o.currency_id}'
205-
t-esc="total_exempt_amount"/>
199+
t-out="total_exempt_amount"/>
206200
</td>
207201
</tr>
208202

@@ -214,7 +208,7 @@
214208

215209
<t t-set="l10n_do_amount_total" t-value="l10n_do_amounts['invoice_total']"/>
216210
<td class="text-right">
217-
<span class="text-nowrap" t-esc="l10n_do_amount_total"
211+
<span class="text-nowrap" t-out="l10n_do_amount_total"
218212
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
219213
</td>
220214
</tr>
@@ -227,10 +221,10 @@
227221
<t>
228222
<td>
229223
<span class="text-nowrap"
230-
t-esc="tax_aml.tax_line_id.description"/>
224+
t-out="tax_aml.tax_line_id.invoice_label"/>
231225
</td>
232226
<td class="text-right o_price_total">
233-
<span class="text-nowrap" t-esc="l10n_do_wh_amount"
227+
<span class="text-nowrap" t-out="l10n_do_wh_amount"
234228
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
235229
</td>
236230
</t>
@@ -239,12 +233,11 @@
239233

240234
</template>
241235

242-
<template id="report_invoice_document_inherited"
243-
inherit_id="account.report_invoice_document" primary="True">
236+
<template id="report_invoice_document" inherit_id="account.report_invoice_document"
237+
primary="True">
244238

245239
<t t-set="o" position="after">
246-
<t t-set="custom_header" t-value="'l10n_do_accounting.custom_header'"/>
247-
<t t-set="ecf_representation" t-value="o.is_ecf_invoice"/>
240+
<t t-set="custom_header" t-value="'l10n_do.custom_header'"/>
248241
<t t-set="is_l10n_do_invoice"
249242
t-value="o.l10n_latam_use_documents and o.company_id.country_id and o.country_code == 'DO'"/>
250243
</t>
@@ -254,7 +247,7 @@
254247

255248
<!-- replace information section and use dominican style -->
256249
<div id="informations" position="replace">
257-
<t t-call="l10n_do_accounting.informations"/>
250+
<t t-call="l10n_do.informations"/>
258251
</div>
259252

260253
<xpath
@@ -269,24 +262,6 @@
269262

270263
<xpath expr="//div[@id='total']/.." position="after">
271264
<div class="row">
272-
<div class="col-6"
273-
style="display: inline-block; float: left; font-size:11px;">
274-
<t t-if="o.l10n_do_electronic_stamp">
275-
<div>
276-
<img t-att-src="'/report/barcode/?type=QR&amp;width=100&amp;height=100&amp;value=' + o.l10n_do_electronic_stamp if o.l10n_do_electronic_stamp else ''"/>
277-
</div>
278-
<t t-if="o.l10n_do_ecf_security_code">
279-
<strong>Código de Seguridad:</strong>
280-
<span t-esc="o.l10n_do_ecf_security_code"/>
281-
</t>
282-
<br/>
283-
<t t-if="o.l10n_do_ecf_sign_date">
284-
<strong>Fecha Firma Digital:</strong>
285-
<span
286-
t-esc="context_timestamp(o.l10n_do_ecf_sign_date).strftime('%d-%m-%Y')"/>
287-
</t>
288-
</t>
289-
</div>
290265
<div t-if="is_l10n_do_invoice" class="text-muted text-right col-6"
291266
style="float: right;">
292267
<span>
@@ -319,37 +294,34 @@
319294
t-value="line.price_unit * (1 - (line.discount / 100.0))"/>
320295
<t t-set="discount_amount"
321296
t-value="abs(price_unit_wo_discount) if line.discount else 0"/>
322-
<span class="text-nowrap" t-esc="discount_amount"
297+
<span class="text-nowrap" t-out="discount_amount"
323298
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
324299
</td>
325300
</xpath>
326-
<xpath expr="//span[@id='line_tax_ids']" position="attributes">
327-
<attribute name="t-esc">
328-
', '.join(map(lambda x: (x.description or x.name), line.tax_ids)) if not ecf_representation else '%s %s' % (o.currency_id.symbol, '{0:,.2f}'.format(line.l10n_do_itbis_amount))
329-
</attribute>
330-
</xpath>
331301

332-
<xpath expr="//div[@id='total']/div/table/t[@t-call='account.document_tax_totals']"
333-
position="replace">
334-
<t t-call="l10n_do_accounting.document_tax_totals"/>
335-
</xpath>
302+
<!--<xpath
303+
expr="//div[@id='total']/div/table/t[@t-call='account.document_tax_totals']"
304+
position="replace">
305+
<t t-call="l10n_do.document_tax_totals"/>
306+
</xpath>-->
307+
<t t-call="account.document_tax_totals" position="attributes">
308+
<attribute name="t-call">l10n_do.document_tax_totals</attribute>
309+
</t>
336310

337311
</template>
338312

339313
<template id="report_invoice" inherit_id="account.report_invoice">
340314
<xpath expr='//t[@t-call="account.report_invoice_document"]' position="after">
341-
<t t-if="o._get_name_invoice_report() == 'l10n_do_accounting.report_invoice_document_inherited'"
342-
t-call="l10n_do_accounting.report_invoice_document_inherited"
343-
t-lang="lang"/>
315+
<t t-if="o._get_name_invoice_report() == 'l10n_do.report_invoice_document'"
316+
t-call="l10n_do.report_invoice_document" t-lang="lang"/>
344317
</xpath>
345318
</template>
346319

347320
<template id="report_invoice_with_payments"
348321
inherit_id="account.report_invoice_with_payments">
349322
<xpath expr='//t[@t-call="account.report_invoice_document"]' position="after">
350-
<t t-if="o._get_name_invoice_report() == 'l10n_do.report_invoice_document_inherited'"
351-
t-call="l10n_do.report_invoice_document_inherited"
352-
t-lang="lang"/>
323+
<t t-if="o._get_name_invoice_report() == 'l10n_do.report_invoice_document'"
324+
t-call="l10n_do.report_invoice_document" t-lang="lang"/>
353325
</xpath>
354326
</template>
355327

0 commit comments

Comments
 (0)