diff --git a/__init__.py b/__init__.py index 11671ffaead3d4042e93185d6ee1d4b81a032dd5..5ecde703183ac85bbad26d36504d87e633e4d4f3 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 03bef89ad9b4f0793964c9a9e64fbd60a301ba5d..d85cc354fa210f034c4c98bbe9719ea8d0d7a1c0 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 3f2e2f9afde3b0531500aebf67685b6b74a87108..f37c250ee57ca2eb69425300a9a21393f255f17f 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