diff --git a/addons/project/controllers/portal.py b/addons/project/controllers/portal.py index b7e108713d6..98de1ef43ae 100644 --- a/addons/project/controllers/portal.py +++ b/addons/project/controllers/portal.py @@ -63,7 +63,7 @@ class ProjectCustomerPortal(CustomerPortal): # task count task_count = Task.search_count(domain) # pager - url = "/my/project/%s" % project.id + url = "/my/projects/%s" % project.id pager = portal_pager( url=url, url_args={'date_begin': date_begin, 'date_end': date_end, 'sortby': sortby, 'groupby': groupby, 'search_in': search_in, 'search': search}, @@ -146,7 +146,20 @@ class ProjectCustomerPortal(CustomerPortal): }) return request.render("project.portal_my_projects", values) - @http.route(['/my/project/'], type='http', auth="public", website=True) + @http.route(['/my/project/', + '/my/project//page/', + '/my/project//task/', + '/my/project//project_sharing'], type='http', auth="public") + def portal_project_routes_outdated(self, **kwargs): + """ Redirect the outdated routes to the new routes. """ + return request.redirect(request.httprequest.path.replace('/my/project/', '/my/projects/')) + + @http.route(['/my/task', '/my/task/page/'], type='http', auth='public') + def portal_my_task_routes_outdated(self, **kwargs): + """ Redirect the outdated routes to the new routes. """ + return request.redirect(request.httprequest.path.replace('/my/task', '/my/tasks')) + + @http.route(['/my/projects/'], type='http', auth="public", website=True) def portal_my_project(self, project_id=None, access_token=None, page=1, date_begin=None, date_end=None, sortby=None, search=None, search_in='content', groupby=None, task_id=None, **kw): try: project_sudo = self._document_check_access('project.project', project_id, access_token) @@ -195,7 +208,7 @@ class ProjectCustomerPortal(CustomerPortal): session_info['open_task_action'] = task.action_project_sharing_open_task() return session_info - @http.route("/my/project//project_sharing", type="http", auth="user", methods=['GET']) + @http.route("/my/projects//project_sharing", type="http", auth="user", methods=['GET']) def render_project_backend_view(self, project_id, task_id=None): project = request.env['project.project'].sudo().browse(project_id) if not project.exists() or not project.with_user(request.env.user)._check_project_sharing_access(): @@ -206,7 +219,7 @@ class ProjectCustomerPortal(CustomerPortal): {'session_info': self._prepare_project_sharing_session_info(project, task)}, ) - @http.route('/my/project//task/', type='http', auth='public', website=True) + @http.route('/my/projects//task/', type='http', auth='public', website=True) def portal_my_project_task(self, project_id=None, task_id=None, access_token=None, **kw): try: project_sudo = self._document_check_access('project.project', project_id, access_token) @@ -414,7 +427,7 @@ class ProjectCustomerPortal(CustomerPortal): 'grouped_tasks': grouped_tasks, 'page_name': 'task', 'default_url': '/my/tasks', - 'task_url': 'task', + 'task_url': 'tasks', 'pager': pager, 'searchbar_sortings': searchbar_sortings, 'searchbar_groupby': searchbar_groupby, @@ -433,7 +446,7 @@ class ProjectCustomerPortal(CustomerPortal): # The route should not be called if at least hr_timesheet is not installed raise MissingError(_('There is nothing to report.')) - @http.route(['/my/task/'], type='http', auth="public", website=True) + @http.route(['/my/tasks/'], type='http', auth="public", website=True) def portal_my_task(self, task_id, report_type=None, access_token=None, **kw): try: task_sudo = self._document_check_access('project.task', task_id, access_token) diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 29b2dbfc3f5..3e2565c0a44 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -364,7 +364,7 @@ class Project(models.Model): def _compute_access_url(self): super(Project, self)._compute_access_url() for project in self: - project.access_url = '/my/project/%s' % project.id + project.access_url = f'/my/projects/{project.id}' def _compute_access_warning(self): super(Project, self)._compute_access_warning() @@ -1397,7 +1397,7 @@ class Task(models.Model): def _compute_access_url(self): super(Task, self)._compute_access_url() for task in self: - task.access_url = '/my/task/%s' % task.id + task.access_url = f'/my/tasks/{task.id}' def _compute_access_warning(self): super(Task, self)._compute_access_warning() diff --git a/addons/project/views/project_portal_templates.xml b/addons/project/views/project_portal_templates.xml index 17ea2b8d22b..f2fb8fb2edb 100644 --- a/addons/project/views/project_portal_templates.xml +++ b/addons/project/views/project_portal_templates.xml @@ -7,7 +7,7 @@ Projects
  • @@ -61,7 +61,7 @@ - + @@ -262,7 +262,7 @@