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

state = fields.Selection([
                                        ('draft','Draft'),
                                        ('confirm','Confirmed'),
                                        ('process','Processing'),
                                        ('paid','Paid'),        
                                        ('failed','Failed'),
                                        ('success','Success'),
                                        ('cancel','Cancelled')], string='Status', default='draft')

bill_by = fields.Selection([('individual','Individual'),('company','Company')], default="individual", string='Bill by')

<field name="batch_no" attrs="{'readonly': [('state', 'not in', ('paid')), ('bill_by', '!=', 'company')]}"/>


so i want to make batch_no is not readonly when state = paid and  when bill by = company and state = confirm


is that possible ?

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

Hi,

Try the following code

<field name="batch_no" attrs="{'readonly': [('state', 'not in', ['paid','confirm']), ('bill_by', '!=', 'company')]}"/>

Regards

Ảnh đại diện
Huỷ bỏ
Tác giả

i already test with this code before you told me. it can't

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 18
5199
3
thg 8 24
16152
1
thg 3 15
7402
1
thg 3 24
8555
1
thg 9 23
2048