# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models class HelpdeskTeamCollaborator(models.Model): _name = 'helpdesk.team.collaborator' _description = 'Collaborators in helpdesk team shared' team_id = fields.Many2one( 'helpdesk.team', string='Helpdesk Team', required=True, readonly=True, ondelete='cascade', export_string_translation=False ) partner_id = fields.Many2one( 'res.partner', string='Collaborator', required=True, readonly=True, export_string_translation=False ) partner_email = fields.Char( related='partner_id.email', string='Email', readonly=True, export_string_translation=False ) access_mode = fields.Selection( [ ('admin', 'Administrator'), ('user_all', 'User - All Tickets'), ('user_own', 'User - Own Tickets'), ], string='Access Mode', required=True, default='user_own', help="Administrator: can view all tickets and manage other users.\n" "User - All Tickets: can view all tickets and create own tickets.\n" "User - Own Tickets: can only create and view own tickets." ) _sql_constraints = [ ( 'unique_collaborator', 'UNIQUE(team_id, partner_id)', 'A collaborator cannot be selected more than once in the helpdesk team sharing access. Please remove duplicate(s) and try again.' ), ] _rec_name = 'partner_id'