From 1fad5698fc67bb4bbcc6df07828b05ac677099c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 1 Sep 2017 16:28:39 +0200 Subject: [PATCH] [IMP] account: support error, warning and success codes in customer portal Purpose is to allow to display error, warning or success messages based on some user action like payment. This is done using kwargs in the invoice view route. Codes are added in URL and message display has to be managed in the template itself. Inheriting modules and/or new features will have to add their specific message according to the error, warning or success messages they want to support. --- addons/account/controllers/portal.py | 7 +++++++ .../views/account_portal_templates.xml | 21 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/addons/account/controllers/portal.py b/addons/account/controllers/portal.py index d649ab4134f..98999814dc5 100644 --- a/addons/account/controllers/portal.py +++ b/addons/account/controllers/portal.py @@ -45,6 +45,13 @@ class PortalAccount(CustomerPortal): } if access_token: values['no_breadcrumbs'] = True + if kwargs.get('error'): + values['error'] = kwargs['error'] + if kwargs.get('warning'): + values['warning'] = kwargs['warning'] + if kwargs.get('success'): + values['success'] = kwargs['success'] + return values @http.route(['/my/invoices', '/my/invoices/page/'], type='http', auth="user", website=True) diff --git a/addons/account/views/account_portal_templates.xml b/addons/account/views/account_portal_templates.xml index b724c466d13..c4c7abc140e 100644 --- a/addons/account/views/account_portal_templates.xml +++ b/addons/account/views/account_portal_templates.xml @@ -97,6 +97,8 @@
+ +
@@ -261,4 +263,23 @@

+ + + + \ No newline at end of file