<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <record id="view_purchase_order_type_tree" model="ir.ui.view">
        <field name="model">purchase.order.type</field>
        <field name="arch" type="xml">
            <tree name="Purchase Order Types" decoration-muted="active == False">
                <field name="sequence" widget="handle" />
                <field name="active" invisible="True" />
                <field name="name" />
                <field name="sequence_id" />
                <field name="payment_term_id" />
                <field name="incoterm_id" />
                <field name="description" />
                <field name="company_id" groups="base.group_multi_company" />
            </tree>
        </field>
    </record>
    <record id="view_purchase_order_type_form" model="ir.ui.view">
        <field name="model">purchase.order.type</field>
        <field name="arch" type="xml">
            <form string="Type">
                <sheet>
                    <div class="oe_button_box" name="button_box" />
                    <widget
                        name="web_ribbon"
                        title="Archived"
                        bg_color="bg-danger"
                        attrs="{'invisible': [('active', '=', True)]}"
                    />
                    <field name="active" invisible="1" />
                    <div class="oe_title">
                        <label for="name" class="oe_edit_only" />
                        <h1>
                            <field name="name" />
                        </h1>
                    </div>
                    <group>
                        <group>
                            <field name="sequence_id" />
                            <field
                                name="company_id"
                                groups="base.group_multi_company"
                            />
                        </group>
                        <group>
                            <field name="payment_term_id" />
                            <field name="incoterm_id" />
                        </group>
                    </group>
                    <group>
                        <field name="description" nolabel="1" />
                    </group>
                </sheet>
            </form>
        </field>
    </record>
    <record id="view_purchase_order_type_search" model="ir.ui.view">
        <field name="model">purchase.order.type</field>
        <field name="arch" type="xml">
            <search string="Purchase Order Types">
                <field name="name" />
                <field name="sequence_id" />
                <field name="payment_term_id" />
                <field name="incoterm_id" />
                <group expand="0" string="Group By">
                    <filter
                        string="Entry Sequence"
                        name="entry_sequence"
                        domain="[]"
                        context="{'group_by':'sequence_id'}"
                    />
                    <filter
                        string="Payment Term"
                        name="pay_terms"
                        domain="[]"
                        context="{'group_by':'payment_term_id'}"
                    />
                    <filter
                        string="Incoterm"
                        name="incoterm"
                        domain="[]"
                        context="{'group_by':'incoterm_id'}"
                    />
                    <filter
                        string="Company"
                        name="company"
                        domain="[]"
                        context="{'group_by':'company_id'}"
                        groups="base.group_multi_company"
                    />
                </group>
            </search>
        </field>
    </record>
    <record model="ir.actions.act_window" id="action_purchase_order_type_view">
        <field name="name">Purchase Order Types</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">purchase.order.type</field>
        <field name="view_mode">form,tree</field>
        <field name="view_id" ref="view_purchase_order_type_tree" />
        <field name="search_view_id" ref="view_purchase_order_type_search" />
        <field name="help" type="html">
            <p class="oe_view_nocontent_create">
                Click to set a new type for purchase order.
            </p>
        </field>
    </record>
    <menuitem
        id="menu_purchase_order_type"
        parent="purchase.menu_purchase_config"
        sequence="40"
        action="action_purchase_order_type_view"
    />
</odoo>
