[FIX] project: fix groupby and sortby issue in portal view of the project

Before this commit,
When you use the 'group by' feature in the portal view of a project, selecting
any value will group the items by stages.

However, when you choose to 'sort by' any option other than 'Title' or 'Newest',
and then navigate back to the project table using the breadcrumb, it may result
in a traceback. The reason why this error occurs is that the query string
remains in the URL even when you switch back to the 'Project' view using the
breadcrumb.

In this commit, keep_query is keeping query in URL so removing it solve
the issue. By default, the 'Stage' is used as the groupby for each project.

task-3318851

Part-of: odoo/odoo#122485
This commit is contained in:
Yash Vaishnav
2023-06-23 13:26:55 +02:00
parent 67568f13a6
commit b75ef2e965
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -130,6 +130,8 @@ class ProjectCustomerPortal(CustomerPortal):
values['task_id'] = task_id
return request.render("project.project_sharing_portal", values)
project_sudo = project_sudo if access_token else project_sudo.with_user(request.env.user)
if not groupby:
groupby = 'stage'
values = self._project_get_page_view_values(project_sudo, access_token, page, date_begin, date_end, sortby, search, search_in, groupby, **kw)
return request.render("project.portal_my_project", values)
@@ -387,8 +389,6 @@ class ProjectCustomerPortal(CustomerPortal):
# default group by value
if not groupby or (groupby == 'milestone' and not milestones_allowed):
groupby = 'project'
if project:
groupby = 'stage'
if date_begin and date_end:
domain += [('create_date', '>', date_begin), ('create_date', '<=', date_end)]
@@ -3,7 +3,7 @@
<template id="portal_layout" name="Portal layout: project menu entry" inherit_id="portal.portal_breadcrumbs" priority="40">
<xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside">
<li t-if="page_name == 'project' or project" class="col-lg-2" t-attf-class="breadcrumb-item #{'active ' if not project else ''}">
<a t-if="project" t-attf-href="/my/projects?{{ keep_query() }}">Projects</a>
<a t-if="project" t-attf-href="/my/projects">Projects</a>
<t t-else="">Projects</t>
</li>
<li t-if="page_name in ['project_task', 'project_subtasks'] and project" class="breadcrumb-item active">
@@ -63,7 +63,7 @@
<tbody>
<tr t-foreach="projects" t-as="project">
<td>
<a t-attf-href="/my/projects/#{project.id}?{{ keep_query() }}"><span t-field="project.name"/></a>
<a t-attf-href="/my/projects/#{project.id}"><span t-field="project.name"/></a>
</td>
<td class="text-end">
<t t-out="project.task_count" />