跳至內容
選單
此問題已被標幟
1 回覆
3873 瀏覽次數

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

相關帖文 回覆 瀏覽次數 活動
1
8月 18
5167
3
8月 24
16061
1
3月 15
7334
1
3月 24
7733
1
9月 23
1995