Skip to Content
Menú
This question has been flagged
1 Respondre
6483 Vistes

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.

Avatar
Descartar
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
Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
de març 21
5012
3
de març 15
10197
2
de febr. 23
3627
2
d’oct. 20
6240
2
d’oct. 20
4458