From 2bbb038f22d3790fad0481466021e8caee03ac54 Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Wed, 18 Aug 2021 11:15:09 +0200 Subject: [PATCH] [IMP] project: replace the basic portal views when project selected Before this commit, when the portal user is connected and selects a project in the list when he is in `/my/projects` route, we redirect him in the task list of this project. This commit replaces the basic portal view by the project sharing views if the Project Sharing feature is enabled for this project. task-2379518 closes #73341 --- addons/project/controllers/portal.py | 22 ++++++++++++------- .../views/project_sharing_templates.xml | 7 ++++++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/addons/project/controllers/portal.py b/addons/project/controllers/portal.py index cbdb6e87f01..7fdebe216a3 100644 --- a/addons/project/controllers/portal.py +++ b/addons/project/controllers/portal.py @@ -86,7 +86,8 @@ class ProjectCustomerPortal(CustomerPortal): project_sudo = self._document_check_access('project.project', project_id, access_token) except (AccessError, MissingError): return request.redirect('/my') - + if project_sudo.privacy_visibility == 'portal' and not request.env.user._is_public(): + return request.render("project.project_sharing_portal", {'project_id': project_id}) values = self._project_get_page_view_values(project_sudo, access_token, **kw) return request.render("project.portal_my_project", values) @@ -119,15 +120,20 @@ class ProjectCustomerPortal(CustomerPortal): } project_company = project.company_id - session_info.update(cache_hashes=cache_hashes, action_name='project.project_sharing_project_task_action', project_id=project.id, user_companies={ - 'current_company': project_company.id, - 'allowed_companies': { - project_company.id: { - 'id': project_company.id, - 'name': project_company.name, + session_info.update( + cache_hashes=cache_hashes, + action_name='project.project_sharing_project_task_action', + project_id=project.id, + user_companies={ + 'current_company': project_company.id, + 'allowed_companies': { + project_company.id: { + 'id': project_company.id, + 'name': project_company.name, + }, }, }, - }) + ) return request.render( 'project.project_sharing_embed', diff --git a/addons/project/views/project_sharing_templates.xml b/addons/project/views/project_sharing_templates.xml index 2717036f7bc..3456532c48f 100644 --- a/addons/project/views/project_sharing_templates.xml +++ b/addons/project/views/project_sharing_templates.xml @@ -1,6 +1,13 @@ + +