oca-ocb-sale/odoo-bringout-oca-ocb-point_of_sale/point_of_sale/models/res_users.py
Ernad Husremovic 73afc09215 19.0 vanilla
2026-03-09 09:32:12 +01:00

22 lines
736 B
Python

from odoo import models, api
class ResUsers(models.Model):
_name = 'res.users'
_inherit = ['res.users', 'pos.load.mixin']
@api.model
def _load_pos_data_domain(self, data, config):
return [('id', '=', self.env.uid)]
@api.model
def _load_pos_data_fields(self, config):
return ['id', 'name', 'partner_id', 'all_group_ids']
@api.model
def _load_pos_data_read(self, records, config):
read_records = super()._load_pos_data_read(records, config)
if read_records:
read_records[0]['_role'] = 'manager' if config.group_pos_manager_id.id in read_records[0]['all_group_ids'] else 'cashier'
del read_records[0]['all_group_ids']
return read_records