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

I have added group rules for users that the users can only see their own data but I am facing an error. I have written the following code:

 <record id="memes_member_user_rule" model="ir.rule">
            <field name="name">For Users</field>
            <field name="model_id" ref="model_memes_member"/>
            <field name="global" eval="False"/>
            <field name="domain_force">[('parent_id.user_id','=',user.id)]</field>
            <field name="groups" eval="[(4, ref('memes.group_memes_user'))]"/>
        </record>

I am facing the following error:

 raise AttributeError(name)
AttributeError: auto_join
아바타
취소

Please post full traceback error.

베스트 답변

Hello Hammad,
you are facing this error because you implemented wrong values for "domain_force" , to correct it modify your code by replacing this

[('user_id','=',user.id)]

I hope this Information will be Helpful,
Feel free for further assistance on contact@geminatecs.com
Thank you,
Geminate Consultancy Services
w : www.geminatecs.com


아바타
취소
베스트 답변

To fix this error, you need to add the "auto_join" attribute with a value of either True or False to your code. Here's an example of how you can modify your code to include the "auto_join" attribute:


In this example, I set the value of "auto_join" to False, but you can adjust it according to your specific requirements.

record id="memes_member_user_rule" model="ir.rule">
field name="name">For Users
field name="model_id" ref="model_memes_member"/>
field name="global" eval="False"/>
field name="domain_force">[('parent_id.user_id','=',user.id)]
field name="groups" eval="[(4, ref('memes.group_memes_user'))]"/>
field name="auto_join" eval="False"/>
/record>

아바타
취소
베스트 답변

Hi

You can try this method for applying rules,

<record id="your_rule_id" model="ir.rule">
        <field name="name">Rule Name</field>
        <field name="model_id" ref="model_<model_name>"/>
        <field name="domain_force">[('user_id', '=', user.id)]</field>
 
      <field name="groups" eval="[(4, ref('module_name.user_group_id'))]"
</record>

Hope it helps

아바타
취소
관련 게시물 답글 화면 활동
6
7월 23
5965
2
11월 24
1208
1
11월 24
906
1
4월 23
2275
7
2월 23
8674