[IMP] project: add sudo in project.task write dict comprehension

All write operations on the `project.task` model are slowed down significantly
by a dict comprehension mapping tasks to their user_ids because of the access
rules checks. By adding a sudo to that dict comprehension, this commit makes it
bypass those checks and speeds it up.

Task-3164004

closes odoo/odoo#115037

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Vincent Larcin
2023-03-30 15:09:17 +02:00
parent 25cbd9c4e7
commit 641766bd20
+1 -1
View File
@@ -1027,7 +1027,7 @@ class Task(models.Model):
self = self.sudo()
# Track user_ids to send assignment notifications
old_user_ids = {t: t.user_ids for t in self}
old_user_ids = {t: t.user_ids for t in self.sudo()}
if "personal_stage_type_id" in vals and not vals['personal_stage_type_id']:
del vals['personal_stage_type_id']