Skip to Content
Menu
This question has been flagged
1 Atsakyti
6217 Rodiniai

i need a option once i click a button, particular field option should be change to readonly in form. Is it possible to change a field with readonly, after pressing a button? Explain me in detail with example.

Portretas
Atmesti
Best Answer

After Clicking the button Can Update the record State

And set field readonly based on Updated record state

For example,

'name': fields.char('Date', size=64, states={'new': [('readonly', True)]}),

def button_click(self, cr, uid, ids, context=None):
    self.write(cr, uid, ids, {'state': 'new'}, context=context)
    return True
Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
1
kov. 21
4648
3
kov. 15
9729
2
vas. 23
3205
2
spal. 20
5887
2
spal. 20
4134