From d9a711fb23666a0979e7d388798342bf079d19b5 Mon Sep 17 00:00:00 2001 From: Julien - Le Filament <julien@le-filament.com> Date: Mon, 22 Apr 2024 13:59:25 +0200 Subject: [PATCH] 16.0 change perimeter notification --- models/acc_operation.py | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/models/acc_operation.py b/models/acc_operation.py index 9074a77..e9f57af 100644 --- a/models/acc_operation.py +++ b/models/acc_operation.py @@ -70,17 +70,33 @@ class AccOperation(models.Model): return AccessError(_("You are not allowed to call perimeter API")) view_id = self.env.ref("oacc.acc_logs_form").id + + if self.env.user.has_group("oacc.group_operation_superadmin"): + return { + "name": "LOGS", + "view_type": "form", + "view_mode": "form", + "views": [(view_id, "form")], + "res_model": "acc.logs", + "view_id": view_id, + "type": "ir.actions.act_window", + "res_id": log_id.id, + "target": "new", + "flags": {"initial_mode": "view"}, + } + return { - "name": "LOGS", - "view_type": "form", - "view_mode": "form", - "views": [(view_id, "form")], - "res_model": "acc.logs", - "view_id": view_id, - "type": "ir.actions.act_window", - "res_id": log_id.id, - "target": "new", - "flags": {"initial_mode": "view"}, + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': _('Actualisation du périmètre.'), + 'type': 'info', + 'message': "Le périmètre de l'opération a bien été mis à jour dans les onglets 'Points d'injection' et 'Points de soutirage'.", + 'sticky': True, + 'next': { + 'type': 'ir.actions.act_window_close', + } + } } def _get_monthly_enedis_data(self, from_cron): -- GitLab