I want to apply the readonly attribute to all fields of the form if a certain condition is met (i.e. when a field has a certain value).
I would be able to achieve this if I hardcoded all the fields in the form with this:-
attrs="{'readonly': [('stage', '=', 'Freeze')]}"
But I don't wish to do this. This is not an elegant solution and kind of a brittle implementation.
I would like to have an automatic solution. Is there a built-in method that I can overwrite and apply this readonly attribute for all fields irrespective of the fields in the form?