İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
986 Görünümler

Can I use both required and invisible attributes in same field and same attrs like below in odoo16 ? and if not possible how can I achieve this ?

<field name="iwave_bill_to" attrs="{
'required': [('move_type', 'in', ['out_invoice', 'out_refund', 'out_receipt'])],
'invisible': [('move_type', 'not in', ['out_invoice', 'out_refund', 'out_receipt'])]
}"/>

Thank you ,

Avatar
Vazgeç
En İyi Yanıt

Yes, you can use both required and invisible attributes in the same field. Use tuples () instead of lists [].

<field name="iwave_bill_to" attrs="{
'required': [('move_type', 'in', ('out_invoice', 'out_refund', 'out_receipt'))],
'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'out_receipt'))]
}"/>

For some cases, I would rather use a boolean field with a compute. 

I hope this helps! 

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
4
Eki 21
80031
1
Kas 20
4522
0
Eki 17
4899
1
Ağu 23
3280
0
Kas 21
2364