<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <!-- Country -->
        <record id="view_country_tree" model="ir.ui.view">
            <field name="name">res.country.tree</field>
            <field name="model">res.country</field>
            <field name="inherit_id" ref="base.view_country_tree"/>
            <field name="arch" type="xml">
                <field name="code" position="after">
                    <field name="intrastat"/>
                </field>
            </field>
        </record>

        <record id="view_country_form" model="ir.ui.view">
            <field name="name">res.country.form</field>
            <field name="model">res.country</field>
            <field name="inherit_id" ref="base.view_country_form"/>
            <field name="arch" type="xml">
                <field name="code" position="after">
                    <field name="intrastat" select="1"/>
                </field>
            </field>
        </record>

        <!-- Product -->
        <record id="product_normal_form_view" model="ir.ui.view">
            <field name="name">product.normal.form</field>
            <field name="model">product.product</field>
            <field name="inherit_id" ref="product.product_normal_form_view"/>
            <field name="arch" type="xml">
                <field name="product_manager" position="after">
                    <field name="intrastat_id"/>
                </field>
            </field>
        </record>

        <!-- Intrastat code -->
        <record id="view_report_intrastat_code_tree" model="ir.ui.view">
            <field name="name">report.intrastat.code.tree</field>
            <field name="model">report.intrastat.code</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Intrastat code">
                    <field name="name"/>
                    <field name="description"/>
                </tree>
            </field>
        </record>
        <record id="view_report_intrastat_code_form" model="ir.ui.view">
            <field name="name">report.intrastat.code.form</field>
            <field name="model">report.intrastat.code</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Intrastat code">
                    <field name="name" select="1"/>
                    <field name="description" select="1"/>
                </form>
            </field>
        </record>
        <record id="action_report_intrastat_code_tree" model="ir.actions.act_window">
            <field name="name">Intrastat Code</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">report.intrastat.code</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        </record>

        <menuitem action="action_report_intrastat_code_tree" id="menu_report_intrastat_code" 
                parent="base.menu_config_address_book" sequence="2"/>


        <record id="view_report_intrastat_tree" model="ir.ui.view">
            <field name="name">report.intrastat.view</field>
            <field name="model">report.intrastat</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Intrastat Data">
                    <field name="name" />
                    <field name="month"/>
                    <field name="code"/>
                    <field name="ref"/>
                    <field name="intrastat_id"/>
                    <field name="weight"/>
                    <field name="value"/>
                    <field name="supply_units"/>
                    <field name="currency_id"/>
                    <field name="type"/>
                </tree>
            </field>
        </record>

        <record id="view_report_intrastat_search" model="ir.ui.view">
            <field name="name">report.intrastat.search</field>
            <field name="model">report.intrastat</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Intrastat Data">
                    <group col="10" colspan="4">
                        <filter string="This Year" icon="terp-go-year" domain="[('name','=',time.localtime()[0])]"/>
                        <filter string="This Month" icon="terp-go-month" domain="[('month','=',time.localtime()[1])]"/>
                        <separator orientation="vertical"/>
                        <field name="name" select="1"/>
                        <field name="month" select="1"/>
                        <field name="code" select="1"/>
                        <field name="intrastat_id" select="1"/>
                        <field name="type" select="1"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="action_report_intrastat_tree_all" model="ir.actions.act_window">
            <field name="name">Intrastat</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">report.intrastat</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree</field>
            <field name="search_view_id" ref="view_report_intrastat_search"/>
        </record>

        <menuitem action="action_report_intrastat_tree_all" id="menu_report_intrastat_all" 
                parent="stock.next_id_61" sequence="6"/>
    </data>
</openerp>
