From 2e06b0e1ce9bb3d87a1e44d631dcdc1808c1bfcb Mon Sep 17 00:00:00 2001 From: "Thomas Lefebvre (thle)" Date: Wed, 5 Jul 2023 08:56:07 +0000 Subject: [PATCH] [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) Signed-off-by: Thomas Lefebvre (thle) --- addons/project/models/project_task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/models/project_task.py b/addons/project/models/project_task.py index 0efc8decfcf..08df243ad6e 100644 --- a/addons/project/models/project_task.py +++ b/addons/project/models/project_task.py @@ -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]