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

Hello All.

I'm working on my own module, and I'm having two different users here:

manager and normal

I have given manager all access in ir.access.model.csv

access_scarf_designer_manager,access.scarf.designer.manager,model_res_scarf_design,group_scarf_designer_manager,1,1,1,1
and in access rules, I have given access to normal users like this:
<record id="designer_user_access_only_their_own_designs" model="ir.rule">
<field name="name">Designers access only to own files</field>
<field name="model_id" ref="model_res_scarf_design"/>
<field name="domain_force">[('designer_user.id', '=', user.id)]</field>
<field name="groups" eval="[(4, ref('group_scarf_designer_user'))]"/>
<field name="global" eval="True"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_unlink" eval="True"/>
but it does not give access to users at all, nothing.
I have also tried giving access of create in access rights way:
access_scarf_designer_user,access.scarf.designer.user,model_res_scarf_design,group_scarf_designer_user,0,0,1,0 
or I have tried giving access to all table from access rights and limiting users to access other user's records by record rules, and it's still not working.

I'll be happy if you can help.
I'm working in odoo 11

아바타
취소
베스트 답변

Hello,

Try with given bellow codes it's working on my system. 

<record id="module_test_category" model="ir.module.category">

            <field name="name">Test</field>

            <field name="sequence">17</field>

        </record>

        <record id="test_group_user" model="res.groups">

            <field name="name">User</field>

            <field name="category_id" ref="module_test_category"/>

        </record>

        

        <record id="test_group_manager" model="res.groups">

            <field name="name">Manager</field>

            <field name="implied_ids" eval="[(4, ref('test_group_user'))]"/>

            <field name="category_id" ref="module_test_category"/>

        </record>



<record id="test_rule_contract_visibility_user" model="ir.rule">

            <field name="name">User can only see his/her records</field>

            <field name="model_id" ref="model_res_scarf_design"/>

            <field name="groups" eval="[(4, ref('test_group_user'))]"/>

            <field name = "global" eval = "True" />

            <field name="perm_read" eval="True"/>

            <field name="perm_write" eval="True"/>

            <field name="perm_create" eval="True"/>

            <field name="perm_unlink" eval="True"/>

            <field name="domain_force">[('designer_user.id', '=', user.id)]</field>

        </record>




access_scarf_designer_manager, access.scarf.designer.manager, model_res_scarf_design, test_group_manager, 1, 1, 1, 1


access_scarf_designer_user, access.scarf.designer.user, model_res_scarf_design, test_group_user, 1, 0, 1, 0

After installing module check the users of related group for manager and users.
아바타
취소
작성자

thanks for your reply and spent time.

unfortunatly it's still not working for me.

maybe because I have done one thing different and that is I have not given read access to normal users as you said in your last line (which I will paste here at end of my comment). but I have to limit even their read access to other normal users.

access_scarf_designer_user, access.scarf.designer.user, model_res_scarf_design, test_group_user, 1, 0, 1, 0