Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
875 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
4
říj 21
79900
1
lis 20
4456
0
říj 17
4830
1
srp 23
3182
0
lis 21
2271