تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
6112 أدوات العرض

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
مايو 19
6242
1
يوليو 25
1705
1
مايو 25
1697
1
أبريل 25
2276
1
فبراير 25
1562