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

Hi,

I want to have 2 different input fields, dependent if a user is in a group or not. The one if a user is in the group works but the on if the user is not not. I also tried <t groups="not myaddon.group_tag">


<t groups="myaddon.group_tag">
    <field name="category_id"
           widget="many2many_tags"
           placeholder="Tags..."/>
</t>
<t groups="! myaddon.group_tag">
    <field name="category_id"
           widget="many2many_tags"
           options="{'no_create': True}"
           placeholder="Tags not..."/>
</t>

アバター
破棄
最善の回答

I did not find any syntax for this, so I solved it differently

For my dialog (TransientModel) I created a helper field:


def _get_has_mygroup(self):
return self.env.user.has_group('mygroup')

has_mygroup = fields.Boolean(default=_get_has_mygroup)


Afterwards I use it for readonly or invisible conditions.
アバター
破棄

Yes, This is the correct way

関連投稿 返信 ビュー 活動
0
5月 19
6273
1
7月 25
1731
1
5月 25
1738
1
4月 25
2299
1
2月 25
1576