<?xml version="1.0"?>
<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
    <data>
        <record model="res.group" id="group_company_admin">
            <field name="name">Company Administration</field>
        </record>
        <record model="res.user-res.group" id="user_admin_company_admin">
            <field name="user" ref="res.user_admin"/>
            <field name="group" ref="group_company_admin"/>
        </record>

        <record model="res.group" id="group_employee_admin">
            <field name="name">Employee Administration</field>
        </record>
        <record model="res.user-res.group" id="user_admin_employee_admin">
            <field name="user" ref="res.user_admin"/>
            <field name="group" ref="group_employee_admin"/>
        </record>

        <record model="ir.ui.icon" id="company_icon">
            <field name="name">tryton-company</field>
            <field name="path">icons/tryton-company.svg</field>
        </record>

        <menuitem
            name="Companies"
            sequence="20"
            id="menu_company"
            icon="tryton-company"/>
        <record model="ir.ui.menu-res.group" id="menu_currency_group_company_admin">
            <field name="menu" ref="menu_company"/>
            <field name="group" ref="group_company_admin"/>
        </record>
        <record model="ir.ui.menu-res.group" id="menu_currency_group_employee_admin">
            <field name="menu" ref="menu_company"/>
            <field name="group" ref="group_employee_admin"/>
        </record>

        <record model="ir.ui.view" id="company_view_form">
            <field name="model">company.company</field>
            <field name="type">form</field>
            <field name="inherit" eval="None"/>
            <field name="name">company_form</field>
        </record>
        <record model="ir.ui.view" id="company_view_list">
            <field name="model">company.company</field>
            <field name="type">tree</field>
            <field name="priority" eval="10"/>
            <field name="name">company_list</field>
        </record>

        <record model="ir.action.act_window" id="act_company_list">
            <field name="name">Companies</field>
            <field name="res_model">company.company</field>
        </record>
        <record model="ir.action.act_window.view"
            id="act_company_list_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="company_view_list"/>
            <field name="act_window" ref="act_company_list"/>
        </record>
        <record model="ir.action.act_window.view"
            id="act_company_list_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="company_view_form"/>
            <field name="act_window" ref="act_company_list"/>
        </record>
        <menuitem
            parent="menu_company"
            action="act_company_list"
            sequence="10"
            id="menu_company_list"/>

        <record model="ir.model.access" id="access_company">
            <field name="model">company.company</field>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_company_admin">
            <field name="model">company.company</field>
            <field name="group" ref="group_company_admin"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="True"/>
            <field name="perm_create" eval="True"/>
            <field name="perm_delete" eval="True"/>
        </record>

        <record model="ir.ui.view" id="user_view_form">
            <field name="model">res.user</field>
            <field name="inherit" ref="res.user_view_form"/>
            <field name="name">user_form</field>
        </record>
        <record model="ir.ui.view" id="user_view_form_preferences">
            <field name="model">res.user</field>
            <field name="inherit" ref="res.user_view_form_preferences"/>
            <field name="name">user_form_preferences</field>
        </record>

        <record model="ir.ui.view" id="company_config_start_view_form">
            <field name="model">company.company.config.start</field>
            <field name="type">form</field>
            <field name="name">company_config_start_form</field>
        </record>

        <record model="ir.action.wizard" id="act_company_config">
            <field name="name">Configure Company</field>
            <field name="wiz_name">company.company.config</field>
            <field name="window" eval="True"/>
        </record>

        <record model="ir.module.config_wizard.item"
            id="config_wizard_item_company">
            <field name="action" ref="act_company_config"/>
        </record>

        <record model="ir.ui.view" id="employee_view_form">
            <field name="model">company.employee</field>
            <field name="type">form</field>
            <field name="inherit" eval="None"/>
            <field name="priority" eval="10"/>
            <field name="name">employee_form</field>
        </record>

        <record model="ir.ui.view" id="employee_view_tree">
            <field name="model">company.employee</field>
            <field name="type">tree</field>
            <field name="name">employee_tree</field>
        </record>

        <record model="ir.action.act_window" id="act_employee_form">
            <field name="name">Employees</field>
            <field name="res_model">company.employee</field>
        </record>
        <record model="ir.action.act_window.view" id="act_employee_form_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="employee_view_tree"/>
            <field name="act_window" ref="act_employee_form"/>
        </record>
        <record model="ir.action.act_window.view" id="act_employee_form_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="employee_view_form"/>
            <field name="act_window" ref="act_employee_form"/>
        </record>
        <menuitem
            parent="menu_company"
            action="act_employee_form"
            sequence="20"
            id="menu_employee_form"/>

        <record model="ir.action.act_window" id="act_employee_subordinates">
            <field name="name">Supervised by</field>
            <field name="res_model">company.employee</field>
            <field
                name="domain"
                pyson="1"
                eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('supervisor', '=', Eval('active_id')), ('supervisor', 'in', Eval('active_ids')))]"/>
        </record>
        <record model="ir.action.act_window.view" id="act_employee_subordinates_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="employee_view_tree"/>
            <field name="act_window" ref="act_employee_subordinates"/>
        </record>
        <record model="ir.action.act_window.view" id="act_employee_subordinates_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="employee_view_form"/>
            <field name="act_window" ref="act_employee_subordinates"/>
        </record>
        <record model="ir.action.keyword" id="act_employee_subordinates_keyword1">
            <field name="keyword">form_relate</field>
            <field name="model">company.employee,-1</field>
            <field name="action" ref="act_employee_subordinates"/>
        </record>

        <record model="ir.model.access" id="access_employee">
            <field name="model">company.employee</field>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_delete" eval="False"/>
        </record>
        <record model="ir.model.access" id="access_employee_admin">
            <field name="model">company.employee</field>
            <field name="group" ref="group_employee_admin"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="True"/>
            <field name="perm_create" eval="True"/>
            <field name="perm_delete" eval="True"/>
        </record>

        <record model="ir.action.report" id="report_letter">
            <field name="name">Letter</field>
            <field name="model">party.party</field>
            <field name="report_name">party.letter</field>
            <field name="report">company/letter.fodt</field>
        </record>
        <record model="ir.action.keyword" id="report_letter_party">
            <field name="keyword">form_print</field>
            <field name="model">party.party,-1</field>
            <field name="action" ref="report_letter"/>
        </record>
    </data>
</tryton>
