[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
This commit is contained in:
Xavier BOL (xbo)
2021-08-26 14:59:33 +02:00
parent 36f5982e18
commit 2bbb038f22
2 changed files with 21 additions and 8 deletions
+14 -8
View File
@@ -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',
@@ -1,6 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="project_sharing_portal" name="Project Sharing View in Portal">
<t t-call="portal.frontend_layout">
<t t-set="no_footer" t-value="true"/>
<t t-call="project.project_sharing"/>
</t>
</template>
<template id="project_sharing" name="Project Sharing View">
<iframe width="100%" height="100%" frameborder="0" t-attf-src="/embed/project/{{ project_id }}"/>
</template>