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

How do we put conditions on options no_create or no_open in the view:

    <field name="paper_weight_id" options="{'no_open':my_condition_here_1, 'no_create': my_condition_here_2}"/>

I know that there is conditional attrs, ex:

    <field name="alias_id" ... attrs="{'invisible': [('alias_domain', '=', False)]}"/>

How do i have that for options? Specifically for no_open and no_create?

This is not working:

     <field name="paper_weight_id" options="{ 'no_create': [('1', '!=', '1')]}"/>

it evaluates it to True :(

الصورة الرمزية
إهمال

Could you find a solution?

أفضل إجابة

Hi

Indeed you can achieve this through specific group.
You can add field paper_weight_id  twice in view with attrs condition if matches paper_weight_id with option no_create else paper_weight_id without any option.
Hope this makes senses to you.

الصورة الرمزية
إهمال
أفضل إجابة

Did anyone find a less hacky solution?

It seems like "can_create" attribute doesn't work, so you can't use it.

Is there any place where people explain which attributes (domain, attrs, etc...) allow conditions and why?

It's so boring to have to debug the whole code everytime you need any solution.

الصورة الرمزية
إهمال
أفضل إجابة

Hi,

You can use access rights to your model and only allow specific group users to read a record or create a record.


الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
فبراير 17
2684
1
مارس 15
6441
0
سبتمبر 19
4573
1
يوليو 19
6615
2
أغسطس 18
3971