Skip to Content
Menú
This question has been flagged
1 Respondre
7233 Vistes

I found that a field could be made required based on the state of the record, using the state expression as follows:

'check_total': fields.float('Verification Total', digits_compute=dp.get_precision('Account'), readonly=True,  states={'draft':[('readonly',False)]}),

where this is a field in the account_invoice table

I need to extend this behavior to use any other field, how can I achieve this.


Avatar
Descartar
Best Answer

I don't know if it's possible on a field definition level, but on a view level it is :

<field name="default_debit_account_id" attrs="{'required':[('type','in', ('cash', 'bank'))]}" />
Avatar
Descartar
Autor

Thx for help, it worked fine. I 'm also pleased that I'm the first one who upvoted one of your answers.

Related Posts Respostes Vistes Activitat
6
de des. 15
14449
3
de maig 25
1617
1
d’abr. 25
1220
3
de set. 24
14077
2
de febr. 24
2402