<?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"/>
                </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="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="arch" type="xml">
                <form string="Intrastat Code" version="7.0">
                    <group>
                        <field name="name"/>
                        <field name="description"/>
                    </group>
                </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" groups="base.group_no_one"/>


        <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="arch" type="xml">
                <tree string="Intrastat Data" create="false" delete="false">
                    <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" groups="base.group_multi_currency"/>
                    <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="arch" type="xml">
                <search string="Intrastat Data">
                    <field name="name" filter_domain="['|', ('name','ilike',self), ('code','ilike',self)]" string="Intrastat Data"/>
                    <field name="month"/>
                    <field name="type"/>
                    <field name="intrastat_id"/>
                </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>
