From 003f1ded295f5549883271e43a85de6092affb3d Mon Sep 17 00:00:00 2001 From: Juliana <juliana@le-filament.com> Date: Wed, 2 Mar 2022 17:38:27 +0100 Subject: [PATCH] [UPD]Change calcul invoice --- __init__.py | 2 +- models/acc_account.py | 8 ++++++++ models/acc_operation.py | 24 +----------------------- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/__init__.py b/__init__.py index 11671ff..5ecde70 100644 --- a/__init__.py +++ b/__init__.py @@ -1,4 +1,4 @@ # Copyright 2021 Le Filament (<http://www.le-filament.com>) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from . import models, wizard +from . import controllers, models, wizard diff --git a/models/acc_account.py b/models/acc_account.py index 03bef89..d85cc35 100644 --- a/models/acc_account.py +++ b/models/acc_account.py @@ -129,6 +129,14 @@ class AccAccount(models.Model): ) return res + def _compute_access_url(self): + super(AccAccount, self)._compute_access_url() + for move in self: + move.access_url = "/invoice/%s" % (move.id) + + def _get_report_base_filename(self): + return "Facture" + @api.depends( "line_ids", "line_ids.price_total", diff --git a/models/acc_operation.py b/models/acc_operation.py index 3f2e2f9..f37c250 100644 --- a/models/acc_operation.py +++ b/models/acc_operation.py @@ -88,7 +88,7 @@ class AccOperation(models.Model): ("acc_counter_id", "=", acc_delivery_id.id), ("date_slot", ">=", date_start), ("date_slot", "<=", date_end), - ("comp_data_type", "=", "cons"), + ("comp_data_type", "=", "auotocons"), ], ["power", "acc_operation_id", "date_slot"], ["acc_counter_id"], @@ -445,25 +445,3 @@ class AccOperation(models.Model): ) return power_tab_by_cons - # prod_tot = power_tab_by_prod[0]['power'] - power_tab_by_prod[1]['power'] - - # for acc_injection_id in self.acc_injection_ids: - # if acc_injection_id.is_account_auto_activate: - # power_tab_by_prod = self.get_power_by_prod( - # acc_injection_id, date_start, date_end) - # - # power_autoprod_percent = ((power_tab_by_prod[0]['power'] - - # power_tab_by_prod[1]['power']) * 100) / prod_tot - # power_tab_by_cons = self.get_power_by_cons(date_start, date_end) - # for power_cons in power_tab_by_cons: - # - # power_month = (power_cons['power'] / 1000 / 2) * - # (power_autoprod_percent / 100) - # - # price_kwh = self.env['acc.sale.price'].search([ - # ('acc_operation_id', '=', self.id), - # ('acc_injection_id', '=', acc_injection_id.id), - # ('acc_delivery_id', '=', power_cons['acc_counter_id'][0]), - # ('start_date', '<=', date_month), - # ('end_date', '>=', date_month) - # ]).price -- GitLab