If you want to make a form readonly, you just have to include edit="0" when declaring your form (source), e.g.
<form edit="0"> <!-- Your form here --> </form>
Otherwise, if you really insist on using get_view to set all attributes, you should check out the hr_timesheet model's _get_view and maybe even the _apply_time_label methods (addons/hr_timesheet/model/hr_timesheet.py). The code is pretty much all there and then some. In short, I think you'd just need to modify the _get_view method to do something like:
@api.model def _get_view(self, view_id=None, view_type='form', **options): arch, view = super()._get_view(view_id, view_type, **options) # Add on conditionals or pull additional data here. E.g. can check if you only want to make certain view_types readonly. for node in arch.xpath("//field"): node.set('readonly', "1") return arch, view
A word of caution is that if you do this in python and deploy, you're not going to be able to make the fields editable without removing said python code, as opposed to edit="0", which can be toggled ad-hoc via Odoo's debug menu, unless that's what you are going for.
Hope this helps.
Update:
After a little bit more experimenting, this is the closest I got to dynamically setting readonly attributes on all fields. The only caveat to this method is that it sets the readonly attribute to ALL fields, meaning if you have a relational field like a One2many and have defined a tree view for it within your form, you would need to edit the xpath to not select these fields, especially if you include an additional that checks for a field that is not present in the relation's model.
@api.model def _get_view(self, view_id=None, view_type='form', **options): arch, view = super()._get_view(view_id, view_type, **options) if view_type == "form": for node in arch.xpath("//field"): node.set("readonly", "id == 75") return arch, view