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

   _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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
8月 17
4207
1
3月 15
5051
1
5月 25
1054
2
2月 25
6007
1
12月 24
1528