[FIX] analytic: read analytic plan

To reproduce
============
Users in a newly created database are not able to create new projects
that has timesheet enabled

Problem
=======
when creating a project with timesheet, an analytic account is created
which requires reading `analytic.plan` which leads to the access error

Solution
========
read `analytic.plan` through `sudo`

opw-3642817

closes odoo/odoo#146769

Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
Abdelouahab (abla)
2023-12-20 15:21:34 +00:00
parent 497e953d67
commit 70abc5d083
+1 -1
View File
@@ -129,7 +129,7 @@ class AccountAnalyticPlan(models.Model):
@api.depends('parent_id', 'parent_path')
def _compute_root_id(self):
for plan in self:
for plan in self.sudo():
plan.root_id = int(plan.parent_path[:-1].split('/')[0]) if plan.parent_path else plan
@api.depends('name', 'parent_id.complete_name')