From e128287e8e831a182d5a441ae269a846d9ecfd8b Mon Sep 17 00:00:00 2001 From: Harsh Modi Date: Tue, 13 Jun 2023 15:01:12 +0530 Subject: [PATCH] [IMP] l10n_in_edi*: added connection successful notification Whenever a user's is successfully connected with l10n_in_edi* it will display the user a notification of successfully being connected with Indian EDI Services closes odoo/odoo#148418 X-original-commit: 9c0e6123c4b03ca27e1855755ce2728faeb567e6 Signed-off-by: Josse Colpaert Signed-off-by: Harsh Modi (hamo) --- addons/l10n_in_edi/models/res_config_settings.py | 9 +++++++++ .../l10n_in_edi_ewaybill/models/res_config_settings.py | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/addons/l10n_in_edi/models/res_config_settings.py b/addons/l10n_in_edi/models/res_config_settings.py index 9a3922d2489..e03440039bd 100644 --- a/addons/l10n_in_edi/models/res_config_settings.py +++ b/addons/l10n_in_edi/models/res_config_settings.py @@ -32,6 +32,15 @@ class ResConfigSettings(models.TransientModel): self.env["account.edi.format"]._l10n_in_edi_authenticate(self.company_id) if not self.company_id.sudo()._l10n_in_edi_token_is_valid(): raise UserError(_("Incorrect username or password, or the GST number on company does not match.")) + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'type': 'info', + 'sticky': False, + 'message': _("API credentials validated successfully"), + } + } def l10n_in_edi_buy_iap(self): if not self.l10n_in_edi_production_env: diff --git a/addons/l10n_in_edi_ewaybill/models/res_config_settings.py b/addons/l10n_in_edi_ewaybill/models/res_config_settings.py index fe251c4f427..e0116805796 100755 --- a/addons/l10n_in_edi_ewaybill/models/res_config_settings.py +++ b/addons/l10n_in_edi_ewaybill/models/res_config_settings.py @@ -22,3 +22,12 @@ class ResConfigSettings(models.TransientModel): if response.get("error"): error_message = "\n".join(["[%s] %s" % (e.get("code"), html_escape(e.get("message"))) for e in response["error"]]) raise UserError(error_message) + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'type': 'info', + 'sticky': False, + 'message': _("API credentials validated successfully"), + } + }