Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4818 มุมมอง

hi

(odoo11)

I want limit write access to a field with one group.how can do it?

in my open erp6.1 I do this in .py file , like this:

'repair_hw': fields.boolean('Hardware Repair', write=['internal_services.group_internal_services_support_team']),

but I don't know how do it in odoo11?

thanks

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Have you seen the documentation on how you define fields at v11?

https://www.odoo.com/documentation/11.0/reference/orm.html#basic-fields


Checkout the groups parameter.

อวตาร
ละทิ้ง
ผู้เขียน

hi

thanks.yes I seen. but I want all of users can see this fields (readonly). but only one group can edit field!

with "groups" parameter, this field don't show for all users! :(

can you help me?

ผู้เขียน

I found :)

I do in this way:

def _compute_can_edit(self):

self.can_edit_ssection = self.env.user.has_group('support_services.group_s_team')

repair_hw = fields.Boolean('Hardware Repair')

can_edit_ssection = fields.Boolean('edit team section field',compute="_compute_can_edit")

<field name="repair_hw" attrs="{'readonly':[('can_edit_ssection','=',False)]}"/>

Related Posts ตอบกลับ มุมมอง กิจกรรม
Hiding the menu items for user groups แก้ไขแล้ว
1
พ.ค. 23
2040
odoo - access to user manager แก้ไขแล้ว
2
ก.ย. 24
1377
Struggling with ir.model.access.csv แก้ไขแล้ว
2
ก.ย. 21
10513
Administration - Settings แก้ไขแล้ว
2
ส.ค. 19
8322
1
ก.ค. 17
14539