From ca9b8ba6d406266d9349a666e6c59e51302b1c2c Mon Sep 17 00:00:00 2001 From: Juliana <juliana@le-filament.com> Date: Tue, 5 Apr 2022 16:40:35 +0200 Subject: [PATCH] [FIX]Bug on calcul qty surplus --- models/acc_operation.py | 5 +++-- report/account_template.xml | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/models/acc_operation.py b/models/acc_operation.py index 282eb58..5dd021c 100644 --- a/models/acc_operation.py +++ b/models/acc_operation.py @@ -419,6 +419,7 @@ class AccOperation(models.Model): power_surplus = self.get_power_by_prod( injection_id, date_start, date_end ) + Account = self.env["acc.account"] acc_account = Account.create( @@ -426,7 +427,7 @@ class AccOperation(models.Model): "acc_operation_id": self.id, "buyer_id": injection_id.buyer_id.id, "acc_injection_id": injection_id.id, - "power_cons": power_surplus[1]["power"], + "power_cons": power_surplus[1]["power"] / 1000 / 2, "start_date": date_start, "end_date": date_end, # 'price_kwh': price_kwh, @@ -484,7 +485,7 @@ class AccOperation(models.Model): # Création de la ligne du mois AccountLine.create( { - "quantity": power_surplus[1]["power"], + "quantity": power_surplus[1]["power"] / 1000 / 2, "price_unit": interval.price, "acc_account_id": acc_account.id, "start_date": date_interval_start, diff --git a/report/account_template.xml b/report/account_template.xml index 3e3ee25..fe2f7d8 100644 --- a/report/account_template.xml +++ b/report/account_template.xml @@ -493,13 +493,13 @@ <span class="text-nowrap" t-field="line.quantity" - /> + /><span> kWh</span> </td> <td class="text-right"> <span class="text-nowrap" t-field="line.price_unit" - /><span> kWh</span> + /><span> €/kWh</span> </td> <td class="text-right"> <span @@ -547,13 +547,13 @@ <span class="text-nowrap" t-field="line.quantity" - /> + /><span> kWh</span> </td> <td class="text-right"> <span class="text-nowrap" t-field="line.price_unit" - /><span> kWh</span> + /><span> €/kWh</span> </td> <td class="text-right"> <span -- GitLab