[FIX] project: fix task search views priority

Steps to reproduce
------------------
1. Install and open the Timesheets app.
2. Click on the "Start" button on the top left.
3. Click on "Select a Task" and then on "Search More..." to open the list view.
4. The associated search view is not the same as in the Project app.

Explanation
-----------
This occurs because the selected search view will be the one related to the model
with the lowest priority. Since we didn't define a priority for any of the views,
the view `view_task_search_form_base` is the one with the lowest default priority.
However, this is a base view created for inheritance purposes and not intended
to actually be used anywhere.

To solve this issue, this commit adds a very high priority to the base views,
and a low priority to the concrete views we want to be used in such cases.

Note that this unintended behavior is also present in versions below 16.1,
but in a non problematic way (only the project related filters are missing).

---

Enterprise: https://github.com/odoo/enterprise/pull/37812

Task-3217905

closes odoo/odoo#117354

X-original-commit: e68bd3490ee609a82c2a0fb0d76c1e2502a2ffc0
Related: odoo/enterprise#39128
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Vincent Larcin
2023-03-31 17:02:55 +02:00
parent c1d2e712f2
commit 317cf3b85e
+4 -3
View File
@@ -4,7 +4,7 @@
<record id="view_task_search_form_base" model="ir.ui.view">
<field name="name">project.task.search.form</field>
<field name="model">project.task</field>
<field name="priority">100</field>
<field name="priority">999</field>
<field name="arch" type="xml">
<search string="Tasks">
<field name="name" string="Tasks" filter_domain="['|', ('name', 'ilike', self), ('id', 'ilike', self)]"/>
@@ -49,7 +49,7 @@
<field name="model">project.task</field>
<field name="inherit_id" ref="view_task_search_form_base"/>
<field name="mode">primary</field>
<field name="priority">50</field>
<field name="priority">999</field>
<field name="arch" type="xml">
<field name="stage_id" position="after">
<field name="project_id" string="Project"/>
@@ -72,7 +72,7 @@
<field name="model">project.task</field>
<field name="inherit_id" ref="view_task_search_form_project_fsm_base"/>
<field name="mode">primary</field>
<field name="priority">25</field>
<field name="priority">999</field>
<field name="arch" type="xml">
<filter name="date_last_stage_update" position="after">
<filter string="Deadline" name="date_deadline" date="date_deadline"/>
@@ -88,6 +88,7 @@
<field name="model">project.task</field>
<field name="inherit_id" ref="view_task_search_form_project_base"></field>
<field name="mode">primary</field>
<field name="priority">10</field>
<field name="arch" type="xml">
<field name="description" position="after">
<field string="Properties" name="task_properties"/>