<?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="ir.ui.view" id="period_view_form">
            <field name="model">account.period</field>
            <field name="type">form</field>
            <field name="name">period_form</field>
        </record>
        <record model="ir.ui.view" id="period_view_tree">
            <field name="model">account.period</field>
            <field name="type">tree</field>
            <field name="name">period_tree</field>
        </record>
        <record model="ir.ui.view" id="period_view_list_close">
            <field name="model">account.period</field>
            <field name="type">tree</field>
            <field name="name">period_list_close</field>
        </record>

        <record model="ir.action.act_window" id="act_period_form">
            <field name="name">Periods</field>
            <field name="res_model">account.period</field>
            <field name="domain"
                eval="[('company', '=', Eval('context', {}).get('company', -1))]"
                pyson="1"/>
        </record>
        <record model="ir.action.act_window.view" id="act_period_form_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="period_view_tree"/>
            <field name="act_window" ref="act_period_form"/>
        </record>
        <record model="ir.action.act_window.view" id="act_period_form_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="period_view_form"/>
            <field name="act_window" ref="act_period_form"/>
        </record>
        <menuitem
            parent="menu_fiscalyear_configuration"
            action="act_period_form"
            sequence="20"
            id="menu_period_form"/>

        <record model="ir.model.button" id="period_close_button">
            <field name="model">account.period</field>
            <field name="name">close</field>
            <field name="string">Close</field>
        </record>

        <record model="ir.model.button" id="period_reopen_button">
            <field name="model">account.period</field>
            <field name="name">reopen</field>
            <field name="string">Re-Open</field>
        </record>

        <record model="ir.model.button" id="period_lock_button">
            <field name="model">account.period</field>
            <field name="name">lock_</field>
            <field name="string">Lock</field>
            <field name="confirm">Are you sure you want to lock the period?</field>
        </record>

        <record model="ir.action.act_window" id="act_period_form_close">
            <field name="name">Close Periods</field>
            <field name="res_model">account.period</field>
            <field name="search_value"
                eval="[('state', '=', 'open')]" pyson="1"/>
            <field name="order" eval="[('start_date', 'ASC'), ('id', 'ASC')]" pyson="1"/>
        </record>
        <record model="ir.action.act_window.view"
            id="act_period_form_close_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="period_view_list_close"/>
            <field name="act_window" ref="act_period_form_close"/>
        </record>

        <menuitem
            parent="menu_processing"
            action="act_period_form_close"
            sequence="30"
            id="menu_close_period"/>

        <record model="ir.rule.group" id="rule_group_period_companies">
            <field name="name">User in companies</field>
            <field name="model">account.period</field>
            <field name="global_p" eval="True"/>
        </record>
        <record model="ir.rule" id="rule_period_companies">
            <field name="domain"
                eval="[('company', 'in', Eval('companies', []))]"
                pyson="1"/>
            <field name="rule_group" ref="rule_group_period_companies"/>
        </record>
    </data>
</tryton>
