From 36d7f38e42b49284826b8d7e67b347e824c2d58e Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Tue, 15 Feb 2022 13:06:08 +0000 Subject: [PATCH] [IMP] portal,*: clean chatter setup * Consistent use of _get_page_view_values * specify object rendering value as well in the method * docstring improvements Part-of: odoo/odoo#84644 --- addons/account/views/account_portal_templates.xml | 4 +--- addons/portal/controllers/portal.py | 12 ++++++++++++ addons/portal/views/portal_templates.xml | 14 ++++++++++++-- addons/project/views/project_portal_templates.xml | 7 +------ addons/purchase/views/portal_templates.xml | 4 +--- addons/sale/views/sale_portal_templates.xml | 4 +--- 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/addons/account/views/account_portal_templates.xml b/addons/account/views/account_portal_templates.xml index 66e338a39f6..47045e7d0dd 100644 --- a/addons/account/views/account_portal_templates.xml +++ b/addons/account/views/account_portal_templates.xml @@ -144,9 +144,7 @@

History

- - - +
diff --git a/addons/portal/controllers/portal.py b/addons/portal/controllers/portal.py index 856c4c9c390..48b20654b49 100644 --- a/addons/portal/controllers/portal.py +++ b/addons/portal/controllers/portal.py @@ -398,6 +398,18 @@ class CustomerPortal(Controller): return document_sudo def _get_page_view_values(self, document, access_token, values, session_history, no_breadcrumbs, **kwargs): + """Include necessary values for portal chatter & pager setup (see template portal.message_thread). + + :param document: record to display on portal + :param str access_token: provided document access token + :param dict values: base dict of values where chatter rendering values should be added + :param str session_history: key used to store latest records browsed on the portal in the session + :param bool no_breadcrumbs: + :return: updated values + :rtype: dict + """ + values['object'] = document + if access_token: # if no_breadcrumbs = False -> force breadcrumbs even if access_token to `invite` users to register if they click on it values['no_breadcrumbs'] = no_breadcrumbs diff --git a/addons/portal/views/portal_templates.xml b/addons/portal/views/portal_templates.xml index 4e710e90b26..86fcd2dc1a3 100644 --- a/addons/portal/views/portal_templates.xml +++ b/addons/portal/views/portal_templates.xml @@ -538,10 +538,20 @@ the message will be posted with the identity of the partner_id of the object :hash : signed token with the partner_id using `_sign_token` method (on mail.thread) :pid : identifier of the partner signing the token + + NOTE: for standard portal flows, _get_page_view_values should be used to properly setup the template parameters --> diff --git a/addons/project/views/project_portal_templates.xml b/addons/project/views/project_portal_templates.xml index 2e055e463d1..67f72e72f1b 100644 --- a/addons/project/views/project_portal_templates.xml +++ b/addons/project/views/project_portal_templates.xml @@ -310,12 +310,7 @@

Message and communication history

- - - - - - +
diff --git a/addons/purchase/views/portal_templates.xml b/addons/purchase/views/portal_templates.xml index 3f819100713..dee46aed37d 100644 --- a/addons/purchase/views/portal_templates.xml +++ b/addons/purchase/views/portal_templates.xml @@ -185,9 +185,7 @@

History

- - - +
diff --git a/addons/sale/views/sale_portal_templates.xml b/addons/sale/views/sale_portal_templates.xml index 8ffc1cd65c4..1279e2f3bf8 100644 --- a/addons/sale/views/sale_portal_templates.xml +++ b/addons/sale/views/sale_portal_templates.xml @@ -355,9 +355,7 @@

History

- - - +