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

I noticed that it is used in `hr.employee.public`:

```

image_128 = fields.Image("Image 128", compute='_compute_image', compute_sudo=True)


def _compute_image(self):

    for employee in self:

    employee_id = self.sudo().env['hr.employee'].browse(employee.id)

    ...

```
in the compute method sudo() is used anyways, which implies that compute_sudo doesn't change the self in the compute method to be equivalent to self.sudo();


Then what is the point in adding `compute_sudo`?

아바타
취소
베스트 답변

Compute sudo is described in the docs as  "whether the field should be recomputed as superuser to bypass access rights (by default True for stored fields, False for non stored fields)"

아바타
취소
작성자

but what does it mean? the user in the method is not the superuser unless sudo() is explicitly used.

As sudo bypasses access rights ,in compute_sudo compute field while computing itself again it will not look for the users access rights and compute it as its for superuser.

관련 게시물 답글 화면 활동
compute issue 해결 완료
1
5월 21
4016
2
5월 25
1171
2
8월 22
5602
2
7월 22
7323
1
12월 20
38185