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

   _inherit = 'sale.order'
​proposal_id = fields.Many2one(
        'proposals',
        string='Proposal',
        readonly=True,
        states={'draft': [('readonly', False)]}
    )


I'm trying to understand what is states​ in Many2one field. Proposal​ is a class module that I made. There is state​ field in it but since the flow is to create the proposal first then automatically create sale.order​, why there is states​ in Many2one field? I try to remove it and nothing change. I want to know what states​ do here

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

Hi,


states={'draft': [('readonly', False)]} specifies that when the sale order is in the 'draft' state, the readonly attribute is removed, making the field editable.


Hope this helps

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 17
4442
1
มี.ค. 15
5237
3
ก.ย. 25
1783
1
พ.ค. 25
1262
2
ก.พ. 25
6291