From 4a9133f27aadc7b5ba679aa7f14b276d6304c306 Mon Sep 17 00:00:00 2001 From: Julien - Le Filament <julien@le-filament.com> Date: Mon, 5 May 2025 09:15:33 +0200 Subject: [PATCH] [FIX] fix 401 when superadmin export cdc --- controllers/main.py | 2 ++ tools/export_cdc.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/controllers/main.py b/controllers/main.py index 39fc7f1..72ba925 100644 --- a/controllers/main.py +++ b/controllers/main.py @@ -233,9 +233,11 @@ class CustomerPortal(CustomerPortal): if ( request.env.user.commercial_partner_id.id not in operation.partner_role_ids.partner_id.ids + and not request.env.user.has_group("oacc.group_operation_superadmin") ): raise AccessError(_("You are not allowed to access this operation")) roles = self._get_role(operation) + except AccessError as e: raise werkzeug.exceptions.abort( werkzeug.wrappers.Response(status=401) diff --git a/tools/export_cdc.py b/tools/export_cdc.py index e41bb04..471dc06 100644 --- a/tools/export_cdc.py +++ b/tools/export_cdc.py @@ -100,8 +100,6 @@ def make_cons_data(energy_dict): period.strftime("%d/%m/%Y %H:%M"), # consommation en kwh str(round(energy_dict[period]["cons"], rounding)), - # autocons - str(round(energy_dict[period]["autocons"], rounding)), # allocons str( round( @@ -110,6 +108,8 @@ def make_cons_data(energy_dict): rounding, ) ), + # autocons + str(round(energy_dict[period]["autocons"], rounding)), ] ) ) -- GitLab