Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
7230 Lượt xem

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.


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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'))]}" />
Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
6
thg 12 15
14448
3
thg 5 25
1612
1
thg 4 25
1220
3
thg 9 24
14075
2
thg 2 24
2399