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

iam having some field. i hve two user eg: admin and john. that field should be edit to the admin. but same field readonly to the john user. so how to achieve this in security?

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

@Ramanan 

  In your case it should look something like this:

<?xml version="1.0"?>
<openerp>
    <data>
<record model="ir.ui.view"  id="view_id">
    <field name="name">view.id</field>
    <field name="model">your.model</field>
    <field name="inherit_id" ref="id_of_inherited_view"/>
    <field name="groups_id" eval="[(6, 0, [ref('base.group_userA') ])]"/>
    <field name="arch" type="xml">
        <field name="WO_NOTES" position="attributes">
            <attribute name="readonly">1</attribute>
        </field>
    </field>
</record>
    </data>
</openerp>

Hope this helps!

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

@David.  You cannot make a particular field to be readonly for a particular user.  Odoo's security feature works with groups.  So, you need to first create a group and assign this particular user to that group.  Odoo itself does not provide a staight forward way to make a field to be readonly for a particular group.  You can make it visible to certain list of group by setting the groups attribute to that field.

To achieve what you need, you need to work around the available features.  I've answered similar question before: https://www.odoo.com/forum/help-1/question/how-to-inherit-a-view-with-the-purpose-of-hidding-a-page-from-a-group-73171#answer-73176 although in this case the questioner wanted to hide an element).  You can use readonly attrs to achive make the field readonly.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 6 25
302
0
thg 1 25
1405
0
thg 1 25
1426
1
thg 12 24
1893
0
thg 5 24
1459