Hi,
You can create multiple user groups for your module and use them to restrict access per field
By creating multiple fields in the view:
1. Create a 'stage' field.
2. Create multiple 'stage' field tags in the view and restrict them accordingly. i.e In the respective View Architecture:
field name="stage" groups="module_name.user_group_id_1,module_name.user_group_id_2" readonly=1
field name="stage" groups="module_name.user_group_id_3" readonly=0
In the above snippet, users belonging to user_group_id_1 and 2 will be able to view the field but cannot edit them. Users belonging to user_group_id_3 will be able to both view and edit the field.
By using a compute method:
1. Create a new boolean compute field that depends on any field with default value.
can_edit = fields.Boolean(compute='_compute_can_edit')
api.depends('any_default_field')
def _compute_can_edit(self):
for record in self:
if self.env.user.has_group('module_name.user_group_id_1'):
record.can_edit = True
else:
record.can_edit = False
2. In xml view:
field name="can_edit" invisible="1"
field name="stage" attrs="{'readonly':[('can_edit', '!=', True)]}"
In the above snippet only users belonging to user_group_id_1 will be able to edit the field.
Hope this helps.