Skip to content

[IMP] l10n_cl: enable copy invoice report with legal acknowledgment footer #4822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: 18.0-rd-accounting-onboarding-malb
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions addons/account/views/account_report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,17 @@
<field name="report_file">account.report_hash_integrity</field>
</record>

<record id="action_report_invoice_copy_cl" model="ir.actions.report">
<field name="name">Invoices with Copy</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">l10n_cl.report_invoice_copy</field>
<field name="report_file">l10n_cl.report_invoice_copy</field>
<field name="binding_model_id" ref="account.model_account_move"/>
<field name="binding_type">report</field>
<field name="print_report_name">'%s - COPY' % (object.name)</field>
<field name="domain" eval="[('company_id.country_id.code', '=', 'CL')]"/>
</record>

</data>
</odoo>
1 change: 1 addition & 0 deletions addons/l10n_cl/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
'views/res_bank_view.xml',
'views/res_country_view.xml',
'views/res_company_view.xml',
'views/report_invoice_copy.xml',
'views/report_invoice.xml',
'views/res_partner.xml',
'views/res_config_settings_view.xml',
Expand Down
8 changes: 8 additions & 0 deletions addons/l10n_cl/views/report_invoice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@

</template>

<template id="report_invoice_document_copy" inherit_id="account.report_invoice_document">
<xpath expr="//div[contains(@class, 'page')]" position="after">
<t t-if="is_copy">
<t t-call="l10n_cl.copy_footer"/>
</t>
</xpath>
</template>
Comment on lines +225 to +231

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of an xpath i think that solution is cleaner
image

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(print with cedible is your is_copy)


<!-- FIXME: Temp fix to allow fetching invoice_documemt in Studio Reports with localisation -->
<template id="report_invoice" inherit_id="account.report_invoice">
<xpath expr="//t[@t-call='account.report_invoice_document']" position="after">
Expand Down
28 changes: 28 additions & 0 deletions addons/l10n_cl/views/report_invoice_copy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_invoice_copy">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usually we prefix the id with the module name

<t t-set="is_copy" t-value="True"/>
<t t-call="l10n_cl.report_invoice"/>
</template>

<template id="copy_footer">
<div class="mt32" style="border: 2px solid black; padding: 10px;">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline styling is not the way to go for multiple reasons, i would even say that it should be avoided at all cost ahah
Reason why:

  • Could override existing css rules (example: a class apply the border, by doing the inline styling it will be overriden
  • Maintainability: We use Bootstrap or custom odoo classes, let's say we do a revamp of the css code, it will be way easier to check places that use that class, or even if we change a class we want that piece of code to be modified too
  • Readbility: inline style is really difficult to read specially when there is many style to add

<div class="row">
<div class="col-6">
<p><strong>Nombre:</strong> ______________________________________________</p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we generally avoid the strong balise and use the fw-bold from bootstap

<p><strong>RUT:</strong> ______________________ <strong>FECHA:</strong> __________________</p>
<p><strong>Recinto:</strong> __________________ <strong>FIRMA:</strong> ___________________</p>
</div>
<div class="col-6">
<p style="font-size: 10px;">
El acuse de recibo que se declara en este acto, de acuerdo a lo dispuesto en la letra b) del Art. 4º y la letra c) del Art. 5º de la Ley 19.983, acredita que la entrega de mercadería(s) o servicio(s)
</p>
Comment on lines +18 to +19

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually write those in english and then do the translation with po and pot file

</div>
</div>
</div>
<div style="text-align: right;">
<strong>CEDIBLE</strong>
</div>
Comment on lines +10 to +25

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image


</template>
</odoo>