diff options
| author | Katherine Zaoral <kz@adhoc.com.ar> | 2020-07-22 15:26:21 +0000 |
|---|---|---|
| committer | Katherine Zaoral <kz@adhoc.com.ar> | 2020-08-17 14:09:18 +0000 |
| commit | a0653089fe4639955b0ca866fae2d4051d9dbcc1 (patch) | |
| tree | f64b1f598019e16bfb749f24dfe50f3573e7d3f1 /addons/l10n_cl | |
| parent | 1931a228350e63714ffbc97b8f3a708085abf476 (diff) | |
[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.
Diffstat (limited to 'addons/l10n_cl')
| -rw-r--r-- | addons/l10n_cl/__manifest__.py | 1 | ||||
| -rw-r--r-- | addons/l10n_cl/models/account_move.py | 6 | ||||
| -rw-r--r-- | addons/l10n_cl/views/report_invoice.xml | 39 |
3 files changed, 46 insertions, 0 deletions
diff --git a/addons/l10n_cl/__manifest__.py b/addons/l10n_cl/__manifest__.py index f562cb70c43..f1941906f24 100644 --- a/addons/l10n_cl/__manifest__.py +++ b/addons/l10n_cl/__manifest__.py @@ -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', diff --git a/addons/l10n_cl/models/account_move.py b/addons/l10n_cl/models/account_move.py index 605a2cf0a34..69b170502e9 100644 --- a/addons/l10n_cl/models/account_move.py +++ b/addons/l10n_cl/models/account_move.py @@ -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() diff --git a/addons/l10n_cl/views/report_invoice.xml b/addons/l10n_cl/views/report_invoice.xml new file mode 100644 index 00000000000..0b72ba453d7 --- /dev/null +++ b/addons/l10n_cl/views/report_invoice.xml @@ -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> |
