<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <record model="ir.module.category" id="module_helpdesk_category">
        <field name="name">Helpdesk</field>
        <field name="description">Helpdesk</field>
        <field name="sequence">20</field>
    </record>
    <record id="helpdesk_group_user" model="res.groups">
        <field name="name">Support User</field>
        <field name="category_id" ref="module_helpdesk_category" />
        <field name="implied_ids" eval="[(4,ref('base.group_user'))]" />
    </record>
    <record id="helpdesk_group_team_leader" model="res.groups">
        <field name="name">Team Leader</field>
        <field name="category_id" ref="module_helpdesk_category" />
        <field name="implied_ids" eval="[(4,ref('helpdesk_group_user'))]" />
    </record>
    <record id="helpdesk_group_manager" model="res.groups">
        <field name="name">Support Manager</field>
        <field name="category_id" ref="module_helpdesk_category" />
        <field name="implied_ids" eval="[(4,ref('helpdesk_group_team_leader'))]" />
        <field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]" />
    </record>
    <record model="ir.rule" id="helpdesk_ticket_comp_rule">
        <field name="name">Helpdesk Ticket multi-company</field>
        <field name="model_id" ref="model_helpdesk_ticket" />
        <field name="global" eval="True" />
        <field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field>
    </record>
    <record model="ir.rule" id="helpdesk_ticket_manager_rule">
        <field name="name">Helpdesk Ticket Manager</field>
        <field name="model_id" ref="model_helpdesk_ticket" />
        <field name="domain_force">[(1, '=', 1)]</field>
        <field name="groups" eval="[(4, ref('sh_all_in_one_helpdesk.helpdesk_group_manager'))]" />
    </record>
    <record model="ir.rule" id="helpdesk_ticket_team_leader_rule">
        <field name="name">Helpdesk Ticket Team Leader</field>
        <field name="model_id" ref="model_helpdesk_ticket" />
        <field name="global" eval="True" />
        <field name="domain_force">['|','|','|','&amp;',('team_head','=',user.id),('team_head','=',False),('user_id','=',user.id),('team_id.team_members','in',[user.id]),('team_id.team_head','=',user.id)]</field>
        <field name="groups" eval="[(4, ref('sh_all_in_one_helpdesk.helpdesk_group_team_leader'))]" />
    </record>
    <record model="ir.rule" id="helpdesk_ticket_assigned_user_rule">
        <field name="name">Helpdesk Ticket Assigned User</field>
        <field name="model_id" ref="model_helpdesk_ticket" />
        <field name="global" eval="True" />
        <field name="domain_force">['&amp;',('team_id.team_members','in',[user.id]),'|',('sh_user_ids','in',[user.id]),('user_id','=',user.id)]</field>
        <field name="groups" eval="[(4, ref('sh_all_in_one_helpdesk.helpdesk_group_user'))]" />
    </record>
    <record model="ir.rule" id="helpdesk_team_manager_rule">
        <field name="name">Helpdesk Team Manager</field>
        <field name="model_id" ref="model_helpdesk_team" />
        <field name="global" eval="True" />
        <field name="domain_force">[(1,'=',1)]</field>
        <field name="groups" eval="[(4, ref('sh_all_in_one_helpdesk.helpdesk_group_manager'))]" />
    </record>
    <record model="ir.rule" id="helpdesk_team_team_leader_rule">
        <field name="name">Helpdesk Team Team Leader</field>
        <field name="model_id" ref="model_helpdesk_team" />
        <field name="global" eval="True" />
        <field name="domain_force">['|','|',('team_head','=',user.id),('team_head','=',False),('team_members','in',[user.id])]</field>
        <field name="groups" eval="[(4, ref('sh_all_in_one_helpdesk.helpdesk_group_team_leader'))]" />
    </record>
    <record id="group_helpdesk_sla_policy" model="res.groups">
        <field name="name">Helpdesk SLA Policy</field>
        <field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]" />
    </record>
    <record model="ir.rule" id="helpdesk_sla_comp_rule">
        <field name="name">Helpdesk SLA multi-company</field>
        <field name="model_id" ref="model_sh_helpdesk_sla" />
        <field name="global" eval="True" />
        <field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field>
    </record>
    <record id="group_helpdesk_alarm" model="res.groups">
        <field name="name">Helpdesk Ticket Alarm</field>
        <field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]" />
    </record>
    <record id="sh_ticket_alarm_comp_rule" model="ir.rule">
        <field name="name">Ticket Alarm multi-company</field>
        <field name="model_id" ref="model_sh_ticket_alarm" />
        <field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field>
    </record>
    <record id="helpdesk_group_whatsapp" model="res.groups">
        <field name="name">Helpdesk Whatsapp Feature</field>
        <field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]" />
    </record>
    <record id="group_allow_multi_action" model="res.groups">
        <field name="name">Mass Ticket Update</field>
    </record>
</odoo>