From c874bff3deaf75d84ea27f7101eed48c7ebbe001 Mon Sep 17 00:00:00 2001 From: Daniel Blanco Date: Mon, 7 Jun 2021 13:04:50 +0000 Subject: [PATCH] [FIX] l10n_cl: modifications to report invoice to show tax included in boletas [ADD] l10n_cl: add method to invoice report to format the vat dotted closes odoo/odoo#73869 X-original-commit: 2b500c12c2540e593f3a243bf80de28bd335b7be Related: odoo/enterprise#19705 Signed-off-by: Josse Colpaert --- .../models/l10n_latam_document_type.py | 7 ++++ addons/l10n_cl/models/res_partner.py | 5 +++ addons/l10n_cl/views/report_invoice.xml | 34 +++++++------------ 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/addons/l10n_cl/models/l10n_latam_document_type.py b/addons/l10n_cl/models/l10n_latam_document_type.py index 6e5916b9527..e458cb719ba 100644 --- a/addons/l10n_cl/models/l10n_latam_document_type.py +++ b/addons/l10n_cl/models/l10n_latam_document_type.py @@ -28,3 +28,10 @@ class L10nLatamDocumentType(models.Model): return False return document_number.zfill(6) + + def _filter_taxes_included(self, taxes): + """ In Chile we include taxes depending on document type """ + self.ensure_one() + if self.country_id.code == "CL" and self.code in ['39', '41', '110', '111', '112', '34']: + return taxes.filtered(lambda x: x.l10n_cl_sii_code == 14) + return super()._filter_taxes_included(taxes) diff --git a/addons/l10n_cl/models/res_partner.py b/addons/l10n_cl/models/res_partner.py index f54d3b19732..cc7c978661a 100644 --- a/addons/l10n_cl/models/res_partner.py +++ b/addons/l10n_cl/models/res_partner.py @@ -42,6 +42,11 @@ class ResPartner(models.Model): else: return values['vat'] + def _format_dotted_vat_cl(self, vat): + vat_l = vat.split('-') + n_vat, n_dv = vat_l[0], vat_l[1] + return '%s-%s' % (format(int(n_vat), ',d').replace(',', '.'), n_dv) + @api.model def create(self, values): if values.get('vat'): diff --git a/addons/l10n_cl/views/report_invoice.xml b/addons/l10n_cl/views/report_invoice.xml index 20b3f0560a1..f3df2cdb45a 100644 --- a/addons/l10n_cl/views/report_invoice.xml +++ b/addons/l10n_cl/views/report_invoice.xml @@ -9,7 +9,6 @@ - @@ -51,7 +50,7 @@
RUT: - +

@@ -61,13 +60,11 @@ -
- @@ -145,39 +142,33 @@ line.l10n_latam_price_unit + + ', '.join(map(lambda x: (x.description or x.name), line.l10n_latam_tax_ids)) + + current_subtotal + line.l10n_latam_price_subtotal + + Amount + + line.l10n_latam_price_subtotal - o.l10n_latam_amount_untaxed + + - - - - Taxes - - - - - - - - - -

- - +

@@ -201,7 +192,6 @@ -