how to give field readonly in xml form view, not a in py file
You can do that with the view_attributes() method.
There is an example.
But i think you should examine your need again. Maybe you can find a way how to solve the underlying problem in a different way. It would be helpful if you could share your specific problem.
1 Like