Skip to content
Snippets Groups Projects
Commit 8a57e84a authored by Andrea Grazioso (agr-odoo)'s avatar Andrea Grazioso (agr-odoo)
Browse files

[FIX] sale_timesheet: fix user permission to set sale order


Create a service product [DEMO] with service tracking
'Create a task in a new project'
Create a sale order SO1 with User 1 with [DEMO] product
Create a sale order SO2 with User 2 with [DEMO] product
SO1 will create a task in a project, edit this task and
assign as parent task the one created by SO2

The action will be blocked by security rules, because user 1 cannnot
see the sale order data of user 2 but the action should be
allowed.

Fixing the error with a sudo call

opw-2243370

closes odoo/odoo#50585

X-original-commit: 8c7d0266
Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
parent 4310ba32
No related branches found
No related tags found
No related merge requests found
......@@ -226,7 +226,7 @@ class ProjectTask(models.Model):
def _compute_sale_order_id(self):
for task in self:
if task.billable_type == 'task_rate':
task.sale_order_id = task.sale_line_id.order_id or task.project_id.sale_order_id
task.sale_order_id = task.sale_line_id.sudo().order_id or task.project_id.sale_order_id
elif task.billable_type == 'employee_rate':
task.sale_order_id = task.project_id.sale_order_id
elif task.billable_type == 'no':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment