コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
4804 ビュー

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)]}"/>

関連投稿 返信 ビュー 活動
1
5月 23
2037
2
9月 24
1368
2
9月 21
10508
2
8月 19
8314
1
7月 17
14528