<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

        <!-- #######################################
        ### AEAT MODEL 349 PARTNER RECORD DETAIL ###
        ######################################## -->
        <!-- Tree view -->
        <record id="view_l10n_ES_aeat_mod349_partner_record_detail_tree" model="ir.ui.view">
            <field name="name">AEAT 349 Partner record detail (tree)</field>
            <field name="model">l10n.es.aeat.mod349.partner_record_detail</field>
            <field name="arch" type="xml">
                <tree string="AEAT 349 Partner record detail">
                    <field name="invoice_id"/>
                    <field name="amount_untaxed"/>
                    <field name="date"/>
                </tree>
            </field>
        </record>

        <!-- Form view -->
        <record id="view_l10n_ES_aeat_mod349_partner_record_detail_form" model="ir.ui.view">
            <field name="name">AEAT 349 Partner record detail (form)</field>
            <field name="model">l10n.es.aeat.mod349.partner_record_detail</field>
            <field name="arch" type="xml">
                <form string="AEAT 349 Partner record">
                    <group>
                        <field name="invoice_id"/>
                        <field name="amount_untaxed"/>
                        <field name="date"/>
                    </group>
                </form>
            </field>
        </record>

        <!-- #################################
        ### AEAT MODEL 349 PARTNER RECORDS ###
        ################################## -->
        <!-- Tree view -->
        <record id="view_l10n_ES_aeat_mod349_partner_record_tree" model="ir.ui.view">
            <field name="name">AEAT 349 Partner record (tree)</field>
            <field name="model">l10n.es.aeat.mod349.partner_record</field>
            <field name="arch" type="xml">
                <tree string="AEAT 349 Partner records" colors="red:partner_record_ok==False">
                    <field name="partner_record_ok" invisible="1"/>
                    <field name="operation_key"/>
                    <field name="country_id"/>
                    <field name="partner_vat"/>
                    <field name="partner_id"/>
                    <field name="total_operation_amount"/>
                </tree>
            </field>
        </record>

        <!-- Form view -->
        <record id="view_l10n_ES_aeat_mod349_partner_record_form" model="ir.ui.view">
            <field name="name">AEAT 349 Partner record (form)</field>
            <field name="model">l10n.es.aeat.mod349.partner_record</field>
            <field name="arch" type="xml">
                <form string="AEAT 349 Partner records">
                    <notebook colspan="4">
                        <page string="Info">
                            <group>
                                <field name="operation_key"/>
                                <field name="partner_id"/>
                                <field name="country_id"/>
                                <field name="partner_vat" on_change="onchange_format_partner_vat(partner_vat,country_id)"/>
                                <field name="total_operation_amount"/>
                            </group>
                        </page>
                        <page string="Detail lines">
                            <field name="record_detail_ids" nolabel="1"/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>

        <!-- #######################################
        ### AEAT MODEL 349 PARTNER REFUND DETAIL ###
        ######################################## -->
        <!-- Tree view -->
        <record id="view_l10n_ES_aeat_mod349_partner_refund_detail_tree" model="ir.ui.view">
            <field name="name">AEAT 349 Partner refund detail (tree)</field>
            <field name="model">l10n.es.aeat.mod349.partner_refund_detail</field>
            <field name="arch" type="xml">
                <tree string="AEAT 349 Partner refund detail">
                    <field name="invoice_id"/>
                    <field name="amount_untaxed"/>
                    <field name="date"/>
                </tree>
            </field>
        </record>

        <!-- Form view -->
        <record id="view_l10n_ES_aeat_mod349_partner_refund_detail_form" model="ir.ui.view">
            <field name="name">AEAT 349 Partner refund detail (form)</field>
            <field name="model">l10n.es.aeat.mod349.partner_refund_detail</field>
            <field name="arch" type="xml">
                <form string="AEAT 349 Partner refund">
                    <group>
                        <field name="invoice_id"/>
                        <field name="amount_untaxed"/>
                        <field name="date"/>
                    </group>
                </form>
            </field>
        </record>

        <!-- #################################
        ### AEAT MODEL 349 PARTNER REFUNDS ###
        ################################## -->
        <!-- Tree view -->
        <record id="view_l10n_ES_aeat_mod349_partner_refund_tree" model="ir.ui.view">
            <field name="name">AEAT 349 Partner refund (tree)</field>
            <field name="model">l10n.es.aeat.mod349.partner_refund</field>
            <field name="arch" type="xml">
                <tree string="AEAT 349 Partner refunds" colors="red:partner_refund_ok==False">
                    <field name="partner_refund_ok" invisible="1"/>
                    <field name="operation_key"/>
                    <field name="country_id"/>
                    <field name="partner_vat"/>
                    <field name="partner_id"/>
                    <field name="total_operation_amount"/>
                    <field name="total_origin_amount"/>
                    <field name="period_type"/>
                    <field name="fiscalyear_id"/>
                </tree>
            </field>
        </record>

        <!-- Form view -->
        <record id="view_l10n_ES_aeat_mod349_partner_refund_form" model="ir.ui.view">
            <field name="name">AEAT 349 Partner refund (form)</field>
            <field name="model">l10n.es.aeat.mod349.partner_refund</field>
            <field name="arch" type="xml">
                <form string="AEAT 349 Partner refunds">
                    <notebook>
                        <page string="Info">
                            <group colspan="4">
                                <field name="operation_key"/>
                                <field name="partner_id"/>
                                <field name="country_id"/>
                                <field name="partner_vat" on_change="onchange_format_partner_vat(partner_vat,country_id)"/>
                                <field name="total_operation_amount"/>
                                <field name="total_origin_amount"/>
                            </group>
                            <group string="Refund data" colspan="4">
                                <field name="fiscalyear_id"/>
                                <field name="period_type"/>
                            </group>
                        </page>
                        <page string="Details">
                            <field name="refund_detail_ids" nolabel="1"/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>

        <!-- #################
        ### AEAT MODEL 349 ###
        ################## -->
        <!-- Tree view -->
        <record id="view_l10n_es_aeat_mod349_report_tree" model="ir.ui.view">
            <field name="name">l10n_es.aeat.mod349.report.tree</field>
            <field name="model">l10n.es.aeat.mod349.report</field>
            <field name="inherit_id" ref="l10n_es_aeat.view_l10n_es_aeat_report_tree"/>
            <field name="arch" type="xml">
                <tree position="attributes">
                    <attribute name="string">AEAT 349 reports</attribute>=
                </tree>
                <field name="fiscalyear_id" position="after">
                    <field name="total_partner_records"/>
                    <field name="total_partner_records_amount"/>
                    <field name="total_partner_refunds"/>
                    <field name="total_partner_refunds_amount"/>
                </field>
            </field>
        </record>

        <!-- Form view -->
        <record id="view_l10n_es_aeat_mod349_report_form" model="ir.ui.view">
            <field name="name">l10n_es.aeat.mod349.report.form</field>
            <field name="model">l10n.es.aeat.mod349.report</field>
            <field name="inherit_id" ref="l10n_es_aeat.view_l10n_es_aeat_report_form"/>
            <field name="arch" type="xml">
                <button name="%(l10n_es_aeat.action_wizard_aeat_export)d" position="attributes">
                    <attribute name="name">%(action_wizard_aeat_mod349_export)d</attribute>
                </button>
                <field name="period_type" position="replace">
                    <group colspan="2" col="4">
                        <field name="period_type"/>
                        <field name="calculate_date"/>
                    </group>
                </field>
                <group string="Declaración" position="after">
                    <notebook colspan="4">
                        <page string="General">
                            <group string="Resultado">
                                <group>
                                    <field name="total_partner_records"/>
                                    <field name="total_partner_records_amount"/>
                                </group>
                                <group>
                                    <field name="total_partner_refunds"/>
                                    <field name="total_partner_refunds_amount"/>
                                </group>
                            </group>
                            <group string="Options" colspan="4">
                                <field name="frequency_change"/>
                            </group>
                        </page>
                        <page string="Partner records">
                            <field name="partner_record_ids" nolabel="1"/>
                        </page>
                        <page string="Refunds">
                            <field name="partner_refund_ids" nolabel="1"/>
                        </page>
                    </notebook>
                </group>
            </field>
        </record>

        <!-- Window action -->
        <record id="action_l10n_es_aeat_mod349_report" model="ir.actions.act_window">
            <field name="name">AEAT Model 349</field>
            <field name="res_model">l10n.es.aeat.mod349.report</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="help">Create and query AEAT Model 349 reports</field>
        </record>
        <record model="ir.actions.act_window.view" id="action_l10n_es_aeat_mod303_report_tree">
            <field name="sequence" eval="2"/>
            <field name="view_mode">tree</field>
            <field name="view_id" ref="view_l10n_es_aeat_mod349_report_tree"/>
            <field name="act_window_id" ref="action_l10n_es_aeat_mod349_report"/>
        </record>
        <record model="ir.actions.act_window.view" id="action_l10n_es_aeat_mod349_report_form">
            <field name="sequence" eval="3"/>
            <field name="view_mode">form</field>
            <field name="view_id" ref="view_l10n_es_aeat_mod349_report_form"/>
            <field name="act_window_id" ref="action_l10n_es_aeat_mod349_report"/>
        </record>

        <!-- ### MENU ACCESS ### -->
        <menuitem
            id="menu_aeat_mod349_report"
            parent="l10n_es_aeat.menu_root_aeat"
            action="action_l10n_es_aeat_mod349_report"
            sequence="349"
            name="AEAT 349 Model"/>

    </data>
</openerp>
