-
- Downloads
[FIX] project: ignore sort key in url args when it's invalid
Issue:
In the project's portal view, if the user is previewing his tasks of a
project with a specific order that is not date or name, and then
goes back to the project list view via the breadcrumb, he is met
with an error 500.
Steps to reproduce:
- Install Project
- With the portal user, go to Project
- Click on a project and sort the task by 'project'
- Go back to the project view via the breadcrumbs.
- Error 500
Cause:
Due to the definition of the url of the breadcrumbs which is
set with `keep_query` which keeps the arguments of the url. The
issue with that is that for the project list view, some of the sort
arguments are not defined, as they are only present in the task view.
So if we sort based on 'project' there is a `KeyError` in the
controller of the project portal view.
Fix:
If the `sortby` is not one of the valid keys, we fallback on 'date'
sorting, which is the behaviour in case when there is no `sortby`
argument in the url. This will keep the `sortby` in the arguments of
the URL, but just ignoring it. This is better UX than having a hard
redirection, because if the user decides to click on a project, the
tasks will be sorted with his previous order specified, which is
usually the wanted behaviour.
Affected versions:
15.0 -> 16.0
opw-3425342
closes odoo/odoo#129016
Signed-off-by:
Xavier Bol (xbo) <xbo@odoo.com>
Loading