From d88abf869b266820aaa2e51cc7ffaf96be9d6f76 Mon Sep 17 00:00:00 2001 From: Juliana <juliana@le-filament.com> Date: Wed, 5 Apr 2023 12:43:59 +0200 Subject: [PATCH] [UPD]Update template invoice --- models/acc_account.py | 14 ++++++++++++-- report/account_template.xml | 27 +++++++++++++++++---------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/models/acc_account.py b/models/acc_account.py index 0c9e15b..cd81abc 100644 --- a/models/acc_account.py +++ b/models/acc_account.py @@ -108,6 +108,12 @@ class AccAccount(models.Model): readonly=True, compute="_compute_amount", ) + amount_divers_tot = fields.Monetary( + string="Montant Total Divers HT", + store=True, + readonly=True, + compute="_compute_amount", + ) power_cons = fields.Float( "Consommation locale (index Enedis)", digits="Unité de Mesure" ) @@ -185,14 +191,17 @@ class AccAccount(models.Model): tot_qty = 0.0 tot_accise = 0.0 tot_elec = 0.0 + tot_divers = 0.0 for line in move.line_ids: total += line.price_total tot_qty += line.quantity - if line.is_tax: + if line.is_tax and line.acc_injection_id: tot_accise += line.price_total - else: + elif line.acc_injection_id: tot_elec += line.price_total + else: + tot_divers += line.price_total if move.is_tva and move.tax_id: total_tax = (total * move.tax_id.amount) / 100 @@ -202,6 +211,7 @@ class AccAccount(models.Model): move.amount_total = total + total_tax move.amount_accise_tot = tot_accise move.amount_elec_tot = tot_elec + move.amount_divers_tot = tot_divers def _compute_url(self): """ diff --git a/report/account_template.xml b/report/account_template.xml index 28d48f3..5191f36 100644 --- a/report/account_template.xml +++ b/report/account_template.xml @@ -202,7 +202,7 @@ alt="Logo" /> </t> - <t t-else=""><h4 t-esc="o.producer_id.name" /></t> + <t t-else=""><h4 t-field="o.producer_id.name" /></t> </div> <div class="col-8 text-center"> @@ -388,21 +388,28 @@ </td> </tr> <tr> - <td /> - <td /> + <td>Total Frais Divers / Régularisation</td> + <td class="text-right"> + <span t-field="o.amount_divers_tot" /> <span + >HT</span> + </td> </tr> <tr> <td /> <td /> </tr> <tr> - <td><strong><h5 - >Total H.T.</h5></strong></td> - <td class="text-right"> - <h4 t-field="o.amount_untaxed" /> - </td> + <td /> + <td /> </tr> <t t-if="o.is_tva"> + <tr> + <td><strong><h5 + >Total H.T.</h5></strong></td> + <td class="text-right"> + <h4 t-field="o.amount_untaxed" /> + </td> + </tr> <tr style=""> <t> <td><span @@ -478,7 +485,7 @@ alt="Logo" /> </t> - <t t-else=""><h4 t-esc="o.producer_id.name" /></t> + <t t-else=""><h4 t-field="o.producer_id.name" /></t> </div> <div class="col-8"></div> </div> @@ -669,7 +676,7 @@ alt="Logo" /> </t> - <t t-else=""><h4 t-esc="o.producer_id.name" /></t> + <t t-else=""><h4 t-field="o.producer_id.name" /></t> </div> <div class="col-8"></div> </div> -- GitLab