Reputation: 410
I need to show user its own assigned POS. I mean, I need to hide other POS on POS dashboard. Consider following example
There are three users
user 1, user 2 and user 3
and there are three POSs
POS 1, POS 2, POS 3
Now
User 1 has rights to access POS 1, and User 1 should not be able to access otherusers POS's
User 2 has rights to access POS 2, and User 2 should not be able to access other users POS's
User 3 has rights to access POS 3, and User 3 should not be able to access other users POS's
Please help me in that
Upvotes: 0
Views: 812
Reputation: 836
pos.config model:
user_id = fields.Many2one('res.users', "User")
Add this field on the view, here is where u choose the user that will have access to that configuration (Configuration > Points of sale)
pos.session model:
config_id = fields.Many2one('pos.config', 'Point of Sale',
help="The physical point of sale you will use.",
required=True,
select=1,
domain = _get_pos_config_domain)
def _get_pos_config_domain(self):
pos_config_ids = self.env['pos.config'].search([('user_id', '=', self.env.context.uid)])
domain = [('state', '=', 'active'), ('id', 'in', pos_config_ids)]
return domain
Upvotes: 1