<?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_purchase_amendment">
            <field name="name">Purchase Amendment</field>
        </record>
        <record model="res.user-res.group" id="user_admin_group_purchase_amendment">
            <field name="user" ref="res.user_admin"/>
            <field name="group" ref="group_purchase_amendment"/>
        </record>

        <record model="ir.ui.view" id="purchase_view_form">
            <field name="model">purchase.purchase</field>
            <field name="inherit" ref="purchase.purchase_view_form"/>
            <field name="name">purchase_form</field>
        </record>

        <record model="ir.ui.view" id="purchase_amendment_view_list">
            <field name="model">purchase.amendment</field>
            <field name="type">tree</field>
            <field name="name">purchase_amendment_list</field>
        </record>

        <record model="ir.ui.view" id="purchase_amendment_view_form">
            <field name="model">purchase.amendment</field>
            <field name="type">form</field>
            <field name="name">purchase_amendment_form</field>
        </record>

        <record model="ir.action.act_window" id="act_purchase_amendment_form">
            <field name="name">Amendments</field>
            <field name="res_model">purchase.amendment</field>
        </record>
        <record model="ir.action.act_window.view" id="act_purchase_amendment_form_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="purchase_amendment_view_list"/>
            <field name="act_window" ref="act_purchase_amendment_form"/>
        </record>
        <record model="ir.action.act_window.view" id="act_purchase_amendment_form_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="purchase_amendment_view_form"/>
            <field name="act_window" ref="act_purchase_amendment_form"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_purchase_amendment_form_domain_draft">
            <field name="name">Draft</field>
            <field name="sequence" eval="10"/>
            <field name="domain" eval="[('state', '=', 'draft')]" pyson="1"/>
            <field name="count" eval="True"/>
            <field name="act_window" ref="act_purchase_amendment_form"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_purchase_amendment_form_domain_validated">
            <field name="name">Validated</field>
            <field name="sequence" eval="20"/>
            <field name="domain" eval="[('state', '=', 'validated')]" pyson="1"/>
            <field name="act_window" ref="act_purchase_amendment_form"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_purchase_amendment_form_domain_all">
            <field name="name">All</field>
            <field name="sequence" eval="9999"/>
            <field name="domain"></field>
            <field name="act_window" ref="act_purchase_amendment_form"/>
        </record>
        <menuitem
            parent="purchase.menu_purchase"
            action="act_purchase_amendment_form"
            sequence="40"
            id="menu_purchase_amendment"/>

        <record model="ir.model.access" id="access_purchase_amendment">
            <field name="model">purchase.amendment</field>
            <field name="perm_read" eval="False"/>
            <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_purchase_amendment_purchase">
            <field name="model">purchase.amendment</field>
            <field name="group" ref="purchase.group_purchase"/>
            <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.rule.group" id="rule_group_purchase_amendment_companies">
            <field name="name">User in companies</field>
            <field name="model">purchase.amendment</field>
            <field name="global_p" eval="True"/>
        </record>
        <record model="ir.rule" id="rule_purchase_amendment_companies">
            <field
                name="domain"
                eval="[('purchase.company', 'in', Eval('companies', []))]"
                pyson="1"/>
            <field name="rule_group" ref="rule_group_purchase_amendment_companies"/>
        </record>

        <record model="ir.model.button" id="purchase_amendment_validation_amendment_button">
            <field name="model">purchase.amendment</field>
            <field name="name">validate_amendment</field>
            <field name="string">Validate</field>
            <field name="confirm">Are you sure you want to validate the amendements?</field>
        </record>
        <record model="ir.model.button-res.group" id="purchase_amendment_validation_amendment_button_group_purchase_amendment">
            <field name="button" ref="purchase_amendment_validation_amendment_button"/>
            <field name="group" ref="group_purchase_amendment"/>
        </record>

        <record model="ir.ui.view" id="purchase_amendment_line_view_list">
            <field name="model">purchase.amendment.line</field>
            <field name="type">tree</field>
            <field name="name">purchase_amendment_line_list</field>
        </record>

        <record model="ir.ui.view" id="purchase_amendment_line_view_form">
            <field name="model">purchase.amendment.line</field>
            <field name="type">form</field>
            <field name="name">purchase_amendment_line_form</field>
        </record>
    </data>
</tryton>
