跳至内容
菜单
此问题已终结
1 回复
7090 查看

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.


形象
丢弃
最佳答案

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'))]}" />
形象
丢弃
编写者

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

相关帖文 回复 查看 活动
6
12月 15
14309
3
5月 25
1326
1
4月 25
1034
3
9月 24
13741
2
2月 24
2202