Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
6604 Lượt xem

In my custom module I use ir.attachment. I added a custom group .

I am trying to set the only read access to the group members.

<record id="ir_attachment_rule_document_access" model="ir.rule">
        <field ref="base.model_ir_attachment" name="model_id"/>
        <field name="name">Document Access</field>
        <field name="perm_read" eval="True"/>
        <field name="perm_write" eval="False"/>
        <field name="perm_create" eval="False"/>
        <field name="perm_unlink" eval="False"/>
        <field name="groups" eval="[(4, ref('lmc_crm.group_doc_user'))]"/>
</record>

I added the access rule in security file,but does not working.(The still read,write,create and unlike acces still there).

Questions 

1)How to set access rule correctly in ir attachment.?

2)is any other method to set the only read access to particular group?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello Aslam,

As per my view, you can override create, write and unlink method of ir.attachment.

Put validation 

if self.env.user.has_group('lmc_crm.group_doc_user'):

    raise ValidationError()

Hope this will help.

Thanks,

                          

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

if self.env.user.has_group('lmc_crm.group_doc_user'):

raise ValidationError()

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 8 22
2296
1
thg 7 22
19998
0
thg 4 22
2969
3
thg 9 21
3155
2
thg 9 21
4414