<?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_party_admin">
            <field name="name">Party Administration</field>
        </record>
        <record model="res.user" id="res.user_admin">
            <field name="groups" eval="[('add', ref('group_party_admin'))]"/>
        </record>
        <record model="res.user" id="res.user_trigger">
            <field name="groups" eval="[('add', ref('group_party_admin'))]"/>
        </record>

        <record model="ir.ui.icon" id="party_icon">
            <field name="name">tryton-party</field>
            <field name="path">icons/tryton-party.svg</field>
        </record>
        <menuitem name="Party Management" sequence="0" id="menu_party"
            icon="tryton-party"/>

        <menuitem name="Configuration" parent="menu_party"
            id="menu_configuration" groups="group_party_admin"
            sequence="0" icon="tryton-preferences"/>

        <record model="ir.ui.view" id="party_view_tree">
            <field name="model">party.party</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <![CDATA[
                <tree string="Parties">
                    <field name="code" select="1"/>
                    <field name="name" select="1"/>
                    <field name="lang" select="2"/>
                    <field name="vat_code" select="1"/>
                </tree>
                ]]>
            </field>
        </record>
        <record model="ir.ui.view" id="party_view_form">
            <field name="model">party.party</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <![CDATA[
                <form string="Party" col="6">
                    <label name="name"/>
                    <field name="name" xexpand="1"/>
                    <label name="code"/>
                    <field name="code"/>
                    <group col="20" colspan="2" id="checkboxes">
                        <label name="active"/>
                        <field name="active" xexpand="0" width="25"/>
                        <!-- Add here some checkboxes ! -->
                    </group>
                    <notebook colspan="6">
                        <page string="General" id="general">
                            <field name="addresses" mode="form,tree" colspan="4">
                                <tree string="Addresses" sequence="sequence"
                                    fill="1">
                                    <field name="name"/>
                                    <field name="street"/>
                                    <field name="streetbis"/>
                                    <field name="zip"/>
                                    <field name="city"/>
                                    <field name="country"/>
                                    <field name="subdivision"/>
                                </tree>
                            </field>
                            <group col="2" colspan="4" id="lang">
                                <label name="lang"/>
                                <field name="lang" widget="selection"/>
                            </group>
                            <field name="contact_mechanisms" colspan="2">
                                <tree string="Contact Mechanisms" sequence="sequence"
                                    fill="1">
                                    <field name="type"/>
                                    <field name="value"/>
                                    <field name="comment"/>
                                </tree>
                            </field>
                            <group col="1" colspan="2" id="categories">
                                <separator string="Categories" id="categories"/>
                                <field name="categories">
                                    <tree string="Categories" fill="1">
                                        <field name="rec_name" select="1"/>
                                    </tree>
                                </field>
                            </group>
                        </page>
                        <page string="Accounting" id="accounting">
                            <separator string="VAT" colspan="4" id="vat"/>
                            <label name="vat_country"/>
                            <field name="vat_country"/>
                            <label name="vat_number"/>
                            <field name="vat_number"/>
                        </page>
                    </notebook>
                </form>
                ]]>
            </field>
        </record>
        <record model="ir.action.act_window" id="act_party_form">
            <field name="name">Parties</field>
            <field name="res_model">party.party</field>
        </record>
        <record model="ir.action.act_window.view" id="act_party_form_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="party_view_tree"/>
            <field name="act_window" ref="act_party_form"/>
        </record>
        <record model="ir.action.act_window.view" id="act_party_form_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="party_view_form"/>
            <field name="act_window" ref="act_party_form"/>
        </record>
        <menuitem parent="menu_party" sequence="1"
            action="act_party_form" id="menu_party_form"/>
        <record model="ir.action.act_window" id="act_party_form2">
            <field name="name">Parties</field>
            <field name="res_model">party.party</field>
        </record>
        <record model="ir.action.act_window.view" id="act_party_form2_view1">
            <field name="sequence" eval="10"/>
            <field name="view" ref="party_view_form"/>
            <field name="act_window" ref="act_party_form2"/>
        </record>
        <record model="ir.action.act_window.view" id="act_party_form2_view2">
            <field name="sequence" eval="20"/>
            <field name="view" ref="party_view_tree"/>
            <field name="act_window" ref="act_party_form2"/>
        </record>
        <menuitem name="New Party" parent="menu_party_form" sequence="1"
            action="act_party_form2" id="menu_party_form2"/>
        <record model="ir.action.act_window" id="act_party_by_category">
            <field name="name">Parties by Category</field>
            <field name="res_model">party.party</field>
            <field name="context">{'categories': [Eval('active_id')]}</field>
            <field name="domain">[('categories', 'child_of', [Eval('active_id')], 'parent')]</field>
        </record>
        <record model="ir.action.keyword" id="act_party_by_category_keyword1">
            <field name="keyword">tree_open</field>
            <field name="model">party.category,0</field>
            <field name="action" ref="act_party_by_category"/>
        </record>
        <record model="ir.action.report" id="report_label">
            <field name="name">Labels</field>
            <field name="model">party.party</field>
            <field name="report_name">party.label</field>
            <field name="report">party/label.odt</field>
        </record>
        <record model="ir.action.keyword" id="report_label_party">
            <field name="keyword">form_print</field>
            <field name="model">party.party,0</field>
            <field name="action" ref="report_label"/>
        </record>

        <record model="ir.sequence.type" id="sequence_type_party">
            <field name="name">Party</field>
            <field name="code">party.party</field>
            <field name="groups"
                eval="[('add', ref('res.group_admin')), ('add', ref('group_party_admin'))]"/>
        </record>
        <record model="ir.sequence" id="sequence_party">
            <field name="name">Party</field>
            <field name="code">party.party</field>
        </record>

        <record model="ir.action.wizard" id="wizard_check_vies">
            <field name="name">Check VIES</field>
            <field name="wiz_name">party.check_vies</field>
            <field name="model">party.party</field>
        </record>
        <record model="ir.action.keyword" id="check_vies_keyword">
            <field name="keyword">form_action</field>
            <field name="model">party.party,0</field>
            <field name="action" ref="wizard_check_vies"/>
        </record>

        <record model="ir.ui.view" id="check_vies_no_check">
            <field name="model">party.check_vies.no_check</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <![CDATA[
                <form string="VAT Information Exchange System">
                    <label string="You must have a recent version of &quot;vatnumber&quot; installed!" id="vatnumber"/>
                </form>
                ]]>
            </field>
        </record>

        <record model="ir.ui.view" id="check_vies_check">
            <field name="model">party.check_vies.check</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <![CDATA[
                <form string="VAT Information Exchange System Results" col="1">
                    <separator name="parties_succeed"/>
                    <field name="parties_succeed">
                        <tree string="Parties Succeed" fill="1">
                            <field name="code"/>
                            <field name="name"/>
                            <field name="vat_code"/>
                        </tree>
                    </field>
                    <separator name="parties_failed"/>
                    <field name="parties_failed">
                        <tree string="Parties Failed" fill="1">
                            <field name="code"/>
                            <field name="name"/>
                            <field name="vat_code"/>
                        </tree>
                    </field>
                </form>
                ]]>
            </field>
        </record>

    </data>
</tryton>
