<?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_blanket_agreement">
            <field name="name">Purchase Blanket Agreement</field>
            <field name="parent" ref="purchase.group_purchase"/>
        </record>
        <record model="res.user-res.group" id="user_admin_group_purchase_blanket_agreement">
            <field name="user" ref="res.user_admin"/>
            <field name="group" ref="group_purchase_blanket_agreement"/>
        </record>

        <record model="ir.ui.view" id="purchase_configuration_view_form">
            <field name="model">purchase.configuration</field>
            <field name="inherit" ref="purchase.purchase_configuration_view_form"/>
            <field name="name">purchase_configuration_form</field>
        </record>

        <record model="ir.sequence.type" id="sequence_type_blanket_agreement">
            <field name="name">Purchase Blanket Agreement</field>
        </record>
        <record model="ir.sequence.type-res.group" id="sequence_type_blanket_agreement_group_admin">
            <field name="sequence_type" ref="sequence_type_blanket_agreement"/>
            <field name="group" ref="res.group_admin"/>
        </record>
        <record model="ir.sequence.type-res.group" id="sequence_type_group_purchase_admin">
            <field name="sequence_type" ref="sequence_type_blanket_agreement"/>
            <field name="group" ref="purchase.group_purchase_admin"/>
        </record>

        <record model="ir.sequence" id="sequence_blanket_agreement">
            <field name="name">Purchase Blanket Agreement</field>
            <field name="sequence_type" ref="sequence_type_blanket_agreement"/>
        </record>

        <record model="ir.ui.view" id="purchase_blanket_agreement_view_form">
            <field name="model">purchase.blanket_agreement</field>
            <field name="type">form</field>
            <field name="name">purchase_blanket_agreement_form</field>
        </record>

        <record model="ir.ui.view" id="purchase_blanket_agreement_view_list">
            <field name="model">purchase.blanket_agreement</field>
            <field name="type">tree</field>
            <field name="name">purchase_blanket_agreement_list</field>
        </record>

        <record model="ir.action.act_window" id="act_purchase_blanket_agreement">
            <field name="name">Blanket Agreements</field>
            <field name="res_model">purchase.blanket_agreement</field>
        </record>
        <record model="ir.action.act_window.view" id="act_purchase_blanket_agreement_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="purchase_blanket_agreement_view_list"/>
            <field name="act_window" ref="act_purchase_blanket_agreement"/>
        </record>
        <record model="ir.action.act_window.view" id="act_purchase_blanket_agreement_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="purchase_blanket_agreement_view_form"/>
            <field name="act_window" ref="act_purchase_blanket_agreement"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_purchase_blanket_agreement_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_blanket_agreement"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_purchase_blanket_agreement_domain_running">
            <field name="name">Running</field>
            <field name="sequence" eval="20"/>
            <field name="domain" eval="[('state', '=', 'running')]" pyson="1"/>
            <field name="count" eval="True"/>
            <field name="act_window" ref="act_purchase_blanket_agreement"/>
        </record>
        <record model="ir.action.act_window.domain" id="act_purchase_blanket_agreement_domain_all">
            <field name="name">All</field>
            <field name="sequence" eval="9999"/>
            <field name="domain"/>
            <field name="act_window" ref="act_purchase_blanket_agreement"/>
        </record>

        <menuitem
            parent="purchase.menu_purchase"
            action="act_purchase_blanket_agreement"
            sequence="20"
            id="menu_purchase_blanket_agreement"/>

        <record model="ir.model.button" id="purchase_blanket_agreement_cancel_button">
            <field name="model">purchase.blanket_agreement</field>
            <field name="name">cancel</field>
            <field name="string">Cancel</field>
        </record>

        <record model="ir.model.button" id="purchase_blanket_agreement_draft_button">
            <field name="model">purchase.blanket_agreement</field>
            <field name="name">draft</field>
            <field name="string">Draft</field>
        </record>

        <record model="ir.model.button" id="purchase_blanket_agreement_run_button">
            <field name="model">purchase.blanket_agreement</field>
            <field name="name">run</field>
            <field name="string">Run</field>
        </record>

        <record model="ir.model.button" id="purchase_blanket_agreement_create_purchase_button">
            <field name="model">purchase.blanket_agreement</field>
            <field name="name">create_purchase</field>
            <field name="string">Create a Purchase</field>
        </record>

        <record model="ir.model.button" id="purchase_blanket_agreement_close_button">
            <field name="model">purchase.blanket_agreement</field>
            <field name="name">close</field>
            <field name="string">Close</field>
        </record>

        <record model="ir.model.access" id="access_purchase_blanket_agreement">
            <field name="model">purchase.blanket_agreement</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_blanket_agreement_group_purchase">
            <field name="model">purchase.blanket_agreement</field>
            <field name="group" ref="purchase.group_purchase"/>
            <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_purchase_blanket_agreement_group_purchase_blanket_agreement">
            <field name="model">purchase.blanket_agreement</field>
            <field name="group" ref="group_purchase_blanket_agreement"/>
            <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_blanket_agreement_companies">
            <field name="name">Purchases Blanket Agreement</field>
            <field name="model">purchase.blanket_agreement</field>
            <field name="global_p" eval="True"/>
        </record>
        <record model="ir.rule" id="rule_purchase_blanket_agreement_companies">
            <field name="domain" eval="[('company', 'in', Eval('companies', []))]" pyson="1"/>
            <field name="rule_group" ref="rule_group_purchase_blanket_agreement_companies"/>
        </record>

        <record model="ir.ui.view" id="purchase_blanket_agreement_line_view_form">
            <field name="model">purchase.blanket_agreement.line</field>
            <field name="type">form</field>
            <field name="name">purchase_blanket_agreement_line_form</field>
        </record>

        <record model="ir.ui.view" id="purchase_blanket_agreement_line_view_list">
            <field name="model">purchase.blanket_agreement.line</field>
            <field name="type">tree</field>
            <field name="name">purchase_blanket_agreement_line_list</field>
        </record>

        <record model="ir.action.act_window" id="act_purchase_form_blanket_agreement">
            <field name="name">Purchases</field>
            <field name="res_model">purchase.purchase</field>
            <field name="domain"
                eval="[('blanket_agreements', 'in', Eval('active_ids'))]"
                pyson="1"/>
            <field name="search_value" eval="[('state', 'not in', ['cancelled'])]" pyson="1"/>
        </record>
        <record model="ir.action.keyword" id="act_purchase_form_blanket_agreement_keyword">
            <field name="keyword">form_relate</field>
            <field name="model">purchase.blanket_agreement,-1</field>
            <field name="action" ref="act_purchase_form_blanket_agreement"/>
        </record>

        <record model="ir.action.wizard" id="purchase_blanked_agreement_create_purchase_wizard">
            <field name="name">Create a Purchase</field>
            <field name="wiz_name">purchase.blanket_agreement.create_purchase</field>
            <field name="model">purchase.blanket_agreement</field>
        </record>
        <record model="ir.action-res.group" id="purchase_blanked_agreement_create_purchase_wizard-group_purchase">
            <field name="action" ref="purchase_blanked_agreement_create_purchase_wizard"/>
            <field name="group" ref="purchase.group_purchase"/>
        </record>

        <record model="ir.ui.view" id="purchase_blanked_agreement_create_purchase_start_form_view">
            <field name="model">purchase.blanket_agreement.create_purchase.start</field>
            <field name="type">form</field>
            <field name="name">purchase_blanket_agreement_create_purchase_start_form</field>
        </record>

        <record model="ir.ui.view" id="purchase_line_form_view">
            <field name="model">purchase.line</field>
            <field name="inherit" ref="purchase.purchase_line_view_form"/>
            <field name="name">purchase_line_form</field>
        </record>

        <record model="ir.ui.view" id="purchase_line_view_list">
            <field name="model">purchase.line</field>
            <field name="inherit" ref="purchase.purchase_line_view_tree"/>
            <field name="name">purchase_line_list</field>
        </record>

        <record model="ir.ui.view" id="purchase_line_view_list_sequence">
            <field name="model">purchase.line</field>
            <field name="inherit" ref="purchase.purchase_line_view_tree_sequence"/>
            <field name="name">purchase_line_list</field>
        </record>

        <record model="ir.action.act_window" id="act_purchase_line_form_blanket_agreement">
            <field name="name">Purchase lines</field>
            <field name="res_model">purchase.line</field>
            <field name="domain"
                eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('blanket_agreement_line.id', '=', Eval('active_id')), ('blanket_agreement_line.id', 'in', Eval('active_ids')))]"
                pyson="1"/>
            <field name="search_value" eval="[('purchase.state', 'not in', ['cancelled'])]" pyson="1"/>
        </record>
        <record model="ir.action.keyword" id="act_purchase_line_form_blanket_agreement_keyword">
            <field name="keyword">form_relate</field>
            <field name="model">purchase.blanket_agreement.line,-1</field>
            <field name="action" ref="act_purchase_line_form_blanket_agreement"/>
        </record>
    </data>
</tryton>
