Skip to content
Snippets Groups Projects
Commit 09039297 authored by damr's avatar damr
Browse files

[FIX] project: fix task navigation in portal project


This commit purpose is to fix the navigation in the project portal. When
a project is shared, the user can access all tasks of the project
from the project portal page, but when he select one task, he can not navigate from one task to another with
the previous and next button on the right of the header.

the commit :

 * fix the previous and next button of the task page. When a task is
reached by pressing one of these buttons, the navigation is not
interrupted and the user can navigate through all the tasks of the
project without having to go back to the project page

task-3032785

closes odoo/odoo#103736

Signed-off-by: default avatarXavier Bol (xbo) <xbo@odoo.com>
parent 76f8670c
No related branches found
No related tags found
No related merge requests found
......@@ -248,7 +248,22 @@ class ProjectCustomerPortal(CustomerPortal):
'user': request.env.user,
'project_accessible': project_accessible,
}
return self._get_page_view_values(task, access_token, values, history, False, **kwargs)
values = self._get_page_view_values(task, access_token, values, history, False, **kwargs)
if project:
history = request.session.get('my_project_tasks_history', [])
try:
current_task_index = history.index(task.id)
except ValueError:
return values
total_task = len(history)
task_url = f"{task.project_id.access_url}/task/%s?model=project.project&res_id={values['user'].id}&access_token={access_token}"
values['prev_record'] = current_task_index != 0 and task_url % history[current_task_index - 1]
values['next_record'] = current_task_index < total_task - 1 and task_url % history[current_task_index + 1]
return values
def _task_get_searchbar_sortings(self):
return {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment