跳至内容
菜单
此问题已终结
1 回复
1699 查看

   _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
4147
1
3月 15
5034
1
5月 25
992
2
2月 25
5964
1
12月 24
1493