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

Record Rule to allow a Manager to update all Employees record and All employee can see their own employee record

아바타
취소
베스트 답변

Hello Gagandeep

Please Try below Record Rules.

For Manager:-

<record id="id" model="ir.rule">
<field name="model_id" ref="model_(model_name)" />
<field name="name">for Manager</field>
<field name="domain_force">[(1,'=',1)]</field>
<field name="groups" eval="[(4,ref('base.group_user'))]"/>
</record>

For Employee:-

<record id="rule_id" model="ir.rule">
<field name="name">for Employee</field>
<field name="model_id" ref="model_(model_name)"/>
<field name="domain_force">[('employee_id.user_id','=',user.id)]</field>
<field name="groups" eval="[(4,ref('base.group_user'))]"/>
</record>


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

Actually I have group Employees which contain both managers and employees groups, so only one rule applied on both groups . either its show all record to all employees or only their own record(same for manager)

아바타
취소
베스트 답변

Hello

by using [('employee_id.user_id','=',user.id)]  we can filter login user mapped employees,

by using ['|',('employee_id.user_id','=',user.id),('employee_id.parent_id.user_id','=',user.id)]  we can filter child's




아바타
취소
관련 게시물 답글 화면 활동
2
1월 23
15955
2
10월 22
11936
1
12월 23
4242
1
1월 23
1742
0
3월 15
3969