Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
1685 Vizualizări

   _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

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
aug. 17
4145
1
mar. 15
5032
1
mai 25
992
2
feb. 25
5957
1
dec. 24
1490