[FIX] project: correct default context
Issue: ------ When we want to add a newly-created user who does not yet have "personal stages" to an fsm task, it triggers a User Error. Cause: ------ There's a mistake in the `project_id` field, which is missing the 's'. Therefore, when creating the personal stage, the ORM does not find the value in the context and inserts the command to set the default project. As a result, when checking constraints, we will trigger an error for the `_check_personal_stage_not_linked_to_projects` method. opw-3390169 closes odoo/odoo#127694 X-original-commit: 05722c9710f74a073833235de9bbe4743485174a Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com> Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
This commit is contained in:
@@ -452,7 +452,7 @@ class Task(models.Model):
|
||||
stage = self.env['project.task.type'].sudo().search([('user_id', '=', user_id.id)], limit=1)
|
||||
# In the case no stages have been found, we create the default stages for the user
|
||||
if not stage:
|
||||
stages = self.env['project.task.type'].sudo().with_context(lang=user_id.partner_id.lang, default_project_id=False).create(
|
||||
stages = self.env['project.task.type'].sudo().with_context(lang=user_id.partner_id.lang, default_project_ids=False).create(
|
||||
self.with_context(lang=user_id.partner_id.lang)._get_default_personal_stage_create_vals(user_id.id)
|
||||
)
|
||||
stage = stages[0]
|
||||
|
||||
Reference in New Issue
Block a user