Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
7257 มุมมอง

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.

Related Posts ตอบกลับ มุมมอง กิจกรรม
[8] Show a state depending on a field แก้ไขแล้ว
6
ธ.ค. 15
14462
3
พ.ค. 25
1646
1
เม.ย. 25
1243
one2one relational field แก้ไขแล้ว
3
ก.ย. 24
14110
2
ก.พ. 24
2419