[REF] project, project_todo: refactor personal stages

Personal stages of project.stage records are based on two main field:
- personal_stage_type_ids: the list of all personal stages linked to a
  task (M2M)
- personal_stage_type_id: a computed field (not stored) indicating the
  personal stage of a task for the current user.

When reading a set of project.task records grouped by personal stages,
two options are possible:
- Group the records by personal_stage_type_id (approach used in former
app Notes): in which case the read_group method has to ne rewritten as
it can be used on a non-stored field.
- Group the records by personal_stage_type_ids (approach used in app
Project) in which case, the kanban view has to be overriden to be able
to drag and drop a task between personal stages (which is not possible
by default, when grouping according to a M2M field).

The main evolution proposed by this refactor is to use an hybrid
approach that would:
1. Group the project.task records by personal_stage_type_id
2. Use the read_group with groupby set to 'personal_stage_type_ids' as
this should give the same result.

This would allow to:
- Avoid a complex and costly (performance wise) read_group override
- Avoid an override of the kanban view that is costly to maintain
- Simplify the implementation (and thus readability) of personal stage
management (among which, removal of the model
project.task.stage.personal).

task-3345132

Part-of: odoo/odoo#140050
This commit is contained in:
Hugo Carlier (Huca)
2023-10-27 14:22:12 +00:00
parent c6bed1a843
commit 2236e5c97c
9 changed files with 121 additions and 143 deletions
@@ -6,7 +6,7 @@
<field name="inherit_id" ref="project.task_type_edit"/>
<field name="arch" type="xml">
<field name="mail_template_id" position="before">
<field name="sms_template_id" context="{'default_model': 'project.task'}" options="{'no_quick_create': True}"/>
<field name="sms_template_id" context="{'default_model': 'project.task'}" options="{'no_quick_create': True}" invisible="user_id"/>
</field>
</field>
</record>