[REF] l10n_cl: Add custom report

Port foward from 13.0 branch . Also adapt _get_name_invoice_report()
method to match the new method in account.
This commit is contained in:
Katherine Zaoral
2020-08-17 14:09:18 +00:00
parent 1931a22835
commit a0653089fe
3 changed files with 46 additions and 0 deletions
+1
View File
@@ -25,6 +25,7 @@ Plan contable chileno e impuestos de acuerdo a disposiciones vigentes
'views/ir_sequence_view.xml',
'views/res_bank_view.xml',
'views/res_country_view.xml',
'views/report_invoice.xml',
'views/res_partner.xml',
'views/res_config_settings_view.xml',
'data/l10n_cl_chart_data.xml',
+6
View File
@@ -114,3 +114,9 @@ class AccountMove(models.Model):
where_string += " AND l10n_latam_document_type_id = %(l10n_latam_document_type_id)s "
param['l10n_latam_document_type_id'] = self.l10n_latam_document_type_id.id or 0
return where_string, param
def _get_name_invoice_report(self):
self.ensure_one()
if self.l10n_latam_use_documents and self.company_id.country_id.code == 'CL':
return 'l10n_cl.report_invoice_document'
return super()._get_name_invoice_report()
+39
View File
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_invoice_document" inherit_id="account.report_invoice_document" primary="True">
<xpath expr="//h2" position="attributes">
<attribute name="t-if">not o.l10n_latam_document_type_id.report_name</attribute>
</xpath>
<xpath expr="//h2" position="after">
<h2 t-if="o.l10n_latam_document_type_id.report_name">
<span t-field="o.l10n_latam_document_type_id.report_name"/>
<span t-field="o.l10n_latam_document_number"/>
</h2>
</xpath>
<xpath expr="//span[@t-field='line.price_unit']" position="attributes">
<attribute name="t-field">line.l10n_latam_price_unit</attribute>
</xpath>
<xpath expr="//span[@id='line_tax_ids']" position="attributes">
<attribute name="t-esc">', '.join(map(lambda x: (x.description or x.name), line.l10n_latam_tax_ids))</attribute>
</xpath>
<t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" position="attributes">
<attribute name="t-value">current_subtotal + line.l10n_latam_price_subtotal</attribute>
</t>
<span t-field="line.price_subtotal" position="attributes">
<attribute name="t-field">line.l10n_latam_price_subtotal</attribute>
</span>
<span t-field="o.amount_untaxed" position="attributes">
<attribute name="t-field">o.l10n_latam_amount_untaxed</attribute>
</span>
</template>
</odoo>