Skip to content
Open
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
1 change: 1 addition & 0 deletions addons/l10n_cl/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
'views/report_invoice.xml',
'views/res_partner.xml',
'views/res_config_settings_view.xml',
'views/report.xml',
'data/l10n_cl_chart_data.xml',
'data/account_tax_report_data.xml',
'data/account_tax_tags_data.xml',
Expand Down
17 changes: 17 additions & 0 deletions addons/l10n_cl/views/report.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="account_invoices_without_payment" model="ir.actions.report">
<field name="name">PDF with Copy</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">l10n_cl.yielding_invoice</field>

Choose a reason for hiding this comment

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

name of the template could be a bit better like report_invoice_document_copy or something like this

<field name="report_file">l10n_cl.yielding_invoice</field>
<field name="print_report_name">(object._get_report_base_filename() + "COPY")</field>

Choose a reason for hiding this comment

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

on other maybe a bit more clean is to extend the function

<field name="attachment"/>
<field name="binding_model_id" ref="model_account_move"/>
<field name="binding_type">report</field>
<field name="domain" eval="[('move_type', '!=', 'entry')]"/>
</record>

</odoo>
62 changes: 61 additions & 1 deletion addons/l10n_cl/views/report_invoice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
</div>
</template>


Choose a reason for hiding this comment

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

Useless diff, even if you are right let's not change stuff for the pleasure of it ahah, the real reason why is that it break the github history and so it's more difficult to find the original pr 😄

<template id="informations">
<div id="informations" class="row mt8 mb8">
<div class="col-6">
Expand Down Expand Up @@ -220,6 +219,57 @@
<attribute name="t-call">l10n_cl.tax_totals_widget</attribute>
</t>

<xpath expr="//div[hasclass('invoice_main')]" position="inside">

Choose a reason for hiding this comment

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

The xpath will need to be changed also to be more precise with the right template

<t t-if="show_info_box">

Choose a reason for hiding this comment

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

t-if can be added to a div directly

<div class="row g-0" style="float: right;">

Choose a reason for hiding this comment

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

in term of construction of code you have 2 choices either using different rows or one big row and put everything in it. That's the solution we chose even it's not the best in term of html it was the cleaner and compact code

<div class="col-12">
<div class="d-inline-block ms-auto" style="width: 440px;">

Choose a reason for hiding this comment

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

Style should be avoided at all cost for different reason:

  • Difficult to maintain, using class we can actually modify the class for everything in the code to have consistency, here you cannot
  • Readability: here you have just one styling so ok but you can have a lot and it will become a nightmare
  • Priority: let's say we have a min height in one of the class, the styling will take priority on everything, which you could lead to problematic behavior

So always use bootstrap class instead 😄

<div class="border border-dark border-3 p-3 bg-white">
<div class="o_info_box">
<div class="row g-0 mb-4">
<div class="col-12 d-flex align-items-end">
<span class="fw-normal me-2 text-nowrap">Nombre:</span>
<span class="flex-grow-1 border-bottom border-dark"></span>
</div>
</div>
<div class="row g-0 mb-4">
<div class="col-6 d-flex align-items-end pe-4">
<span class="fw-normal me-2 text-nowrap">RUT:</span>
<span class="flex-grow-1 border-bottom border-dark"></span>
</div>
<div class="col-6 d-flex align-items-end ps-3">
<span class="fw-normal me-2 text-nowrap">FECHA:</span>
<span class="flex-grow-1 border-bottom border-dark"></span>
</div>
</div>
<div class="row g-0 mb-4">
<div class="col-6 d-flex align-items-end pe-4">
<span class="fw-normal me-2 text-nowrap">Recinto:</span>
<span class="flex-grow-1 border-bottom border-dark"></span>
</div>
<div class="col-6 d-flex align-items-end ps-3">
<span class="fw-normal me-2 text-nowrap">FIRMA:</span>
<span class="flex-grow-1 border-bottom border-dark"></span>
</div>
</div>
<div class="row g-0 pt-2 border-top border-dark">
<div class="col-12">
<p class="small mb-0">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>

Choose a reason for hiding this comment

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

We always add text in english and translate after with pot and po files

</div>
</div>
</div>
</div>
<div class="row g-0 mt-2">
<div class="col-8 ms-auto text-end">
<strong class="h5 fw-bold">CEDIBLE</strong>
</div>
</div>
</div>
</div>
</div>
</t>
</xpath>

Choose a reason for hiding this comment

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

If you use the technique of only one row all of this can be obtain with 25 lines of code maximum ;) And most importantly no style only bootstrap class


</template>

<!-- FIXME: Temp fix to allow fetching invoice_documemt in Studio Reports with localisation -->
Expand Down Expand Up @@ -268,4 +318,14 @@
</tr>
</template>

<template id="yielding_invoice">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="l10n_cl.report_invoice_document">
<t t-set="show_info_box" t-value="True"/>
</t>
</t>
</t>
Comment on lines +322 to +328

Choose a reason for hiding this comment

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

Normally you shouldn't need to use the redefinition of the o variable if you target the right template 🤔 check l10n_cl.report_invoice instead of report_invoice_document.

Suggested change
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="l10n_cl.report_invoice_document">
<t t-set="show_info_box" t-value="True"/>
</t>
</t>
</t>
<t t-call="l10n_cl.report_invoice">
<t t-set="show_info_box" t-value="True"/>
</t>

</template>

Choose a reason for hiding this comment

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

i think it would be better to move everything you did here in enterprise, more precisely in l10n_cl_edi 👀


</odoo>