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

class SaleOrder(models.Model):

    _inherit = "sale.order"

    ...

    picking_state = fields.Selection(string="Picking State", related="picking_id.state")

    # this are a states from "stock.picking" model


    warehouse_id = fields.Many2one(

        'stock.warehouse', string='Warehouse',

        required=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},

        default=_default_warehouse_id)

# at the moment the "readonly" of warehouse_id depends on states from "sale.order"


How to include condition:   readonly=True   when     picking_state == "done"  ?

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

Hi,
You can make the field 'warehouse_id' readonly based on 'picking_state' in the xml part  

<field name="warehouse_id" attrs="{'readonly': [('picking_state', '=', 'done')]}"/>

Regards

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ต.ค. 22
4868
1
ก.ย. 17
5154
1
ก.พ. 16
4673
2
มิ.ย. 17
4106
5
พ.ค. 17
5388