[FIX] project: make personal stage non required in task form view

Since https://github.com/odoo/odoo/pull/90588, the personal stage is a required field in the task form view in debug mode.
However, we only generate personal stage for a given user when that user is first assigned to a task.
If a user creates their first task and assign it to themselves, they won't be able to give it a personal stage.

To prevent issues linked to the current users not having personal stages, this commit makes the field not required, but prevents the user from unsetting it

closes odoo/odoo#99735

Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
This commit is contained in:
Vincent Larcin
2022-09-14 21:21:45 +02:00
committed by Laurent Stukkens (LTU)
parent b79c0e20c8
commit 7f908c6a69
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -2043,6 +2043,9 @@ class Task(models.Model):
# Track user_ids to send assignment notifications
old_user_ids = {t: t.user_ids for t in self}
if "personal_stage_type_id" in vals and not vals['personal_stage_type_id']:
del vals['personal_stage_type_id']
result = super(Task, tasks).write(vals)
if 'user_ids' in vals:
+1 -1
View File
@@ -1300,7 +1300,7 @@
<group>
<field name="is_analytic_account_id_changed" invisible="1"/>
<field name="parent_id" attrs="{'invisible': [('allow_subtasks', '=', False)]}" groups="base.group_no_one"/>
<field name="personal_stage_type_id" string="Personal Stage" groups="base.group_no_one" domain="[('user_id', '!=', False)]" context="{'default_user_id' : uid}" readonly="0" required="1" attrs="{'invisible': &quot;[('user_ids', 'not in', [uid])]&quot;}"/>
<field name="personal_stage_type_id" string="Personal Stage" groups="base.group_no_one" domain="[('user_id', '!=', False)]" context="{'default_user_id' : uid}" readonly="0" attrs="{'invisible': &quot;[('user_ids', 'not in', [uid])]&quot;}"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" context="{'default_partner_id': partner_id}"/>
<field name="analytic_tag_ids" groups="analytic.group_analytic_tags" widget="many2many_tags"/>
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>