콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
1545 화면

In my database, I'd like to create an action on the sales order that archives any associated tasks. However, I'm running into this error when salespeople run the action: 


"You are not allowed to modify 'Task' (project.task) records.


This operation is allowed for the following groups:

- Project/User


Contact your administrator to request access if necessary."

아바타
취소
작성자 베스트 답변

We can insert "sudo()" into our function to bypass any access right or record rule restrictions the logged in user has. Supposing the code looks something like this:


for line in record.order_line:

  to_archive = env['project.task'].search([('sale_line_id','=',line.id)])

  to_archive.write({'active': 0})


We can modify it to the following:


for line in record.order_line:

  to_archive = env['project.task'].search([('sale_line_id','=',line.id)])

  to_archive.sudo().write({'active': 0})


아바타
취소
관련 게시물 답글 화면 활동
1
8월 24
639
1
8월 24
882
1
8월 24
717
1
10월 24
933
1
1월 25
9740