From 58fb7c1df1b3a9c4ac76ad8984b8a173c40a5d12 Mon Sep 17 00:00:00 2001 From: dbkosky Date: Tue, 9 Aug 2022 12:12:28 +0000 Subject: [PATCH] [REF] l10n_it_edi: modify edi prepare function and template Several fields in the l10n_it_edi XML template are adapted fairly often as work progresses on l10n_it_edi/l10n_it_edi_sdicoop. This refactor moves the computation of these field to the python code in _prepare_fattura_pa_export_values. The computation is done for the: (DettaglioLinee) Invoice Lines: NumeroLinea (line number), Descrizione (description), PrezzoUnitario (unit price), PrezzoTotale (line subtotal), (DatiRiepilogo) Tax Lines: Arrotondamento (tax rounding), ImponibileImporto (tax base), Imposta (tax amount). These are computed by the new functions _l10n_it_edi_prepare_line_details and _l10n_it_edi_prepare_tax_details and returned as lists of dictionaries, which are passed to the function that renders the template. The template is modified on the above fields, to reference the above dictionaries, instead of performing the computation in situ. Moving the computation of these fields to the python code has the benefit of: a) easier, more concise computation of these terms b) not requiring users to upgrade the l10n_it_edi module in order to benefit from future changes to these fields (they will only need to upgrade once). Part-of: odoo/odoo#98534 --- .../l10n_it_edi/data/invoice_it_template.xml | 42 ++++------- addons/l10n_it_edi/models/account_invoice.py | 71 +++++++++++++++---- 2 files changed, 71 insertions(+), 42 deletions(-) diff --git a/addons/l10n_it_edi/data/invoice_it_template.xml b/addons/l10n_it_edi/data/invoice_it_template.xml index 1eb9cd1204d..8462e5ea738 100644 --- a/addons/l10n_it_edi/data/invoice_it_template.xml +++ b/addons/l10n_it_edi/data/invoice_it_template.xml @@ -3,14 +3,8 @@