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

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 ?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

Try the following code

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

Regards

อวตาร
ละทิ้ง
ผู้เขียน

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 18
5199
3
ส.ค. 24
16152
1
มี.ค. 15
7402
1
มี.ค. 24
8555
1
ก.ย. 23
2048