<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) EduSense BV <http://www.edusense.nl>
  All rights reserved.

  Copyright (C) 2011 credativ Ltd (<http://www.credativ.co.uk>)

  The licence is in the file __openerp__.py


-->
<openerp>
    <data>

        <!-- Make new view on HSBC exports -->
        <record id="view_banking_export_hsbc_form" model="ir.ui.view">
            <field name="name">account.banking.export.hsbc.form</field>
            <field name="model">banking.export.hsbc</field>
            <field name="arch" type="xml">
                <form string="HSBC Export">
            <notebook>
            <page string="General Information">
                <separator string="HSBC Information" colspan="4" />
                <field name="total_amount" />
                <field name="no_transactions" />
                <separator string="Processing Information" colspan="4" />
                <field name="execution_date" />
                <field name="date_generated" />
                <newline />
                <field name="file" colspan="4" />
            </page>
            <page string="Payment Orders">
                <field name="payment_order_ids" colspan="4" nolabel="1">
                <tree colors="blue:state in ('draft');gray:state in ('cancel','done');black:state in ('open')" string="Payment order">
                    <field name="reference"/>
                    <field name="date_created"/>
                    <field name="date_done"/>
                    <field name="total"/>
                    <field name="state"/>
                </tree>
                </field>
            </page>
            </notebook>
                </form>
            </field>
        </record>
        <record id="view_banking_export_hsbc_tree" model="ir.ui.view">
            <field name="name">account.banking.export.hsbc.tree</field>
            <field name="model">banking.export.hsbc</field>
            <field name="arch" type="xml">
                <tree string="HSBC Export">
                    <field name="execution_date" search="2"/>
                    <field name="date_generated" />
                </tree>
            </field>
        </record>
        <record model="ir.actions.act_window" id="action_account_banking_hsbcs">
            <field name="name">Generated HSBC files</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">banking.export.hsbc</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        </record>

        <!-- Add a menu item for it -->
        <menuitem name="Generated HSBC files"
            id="menu_action_account_banking_exported_hsbc_files"
            parent="account_banking.menu_finance_banking_actions"
            action="action_account_banking_hsbcs"
            sequence="12"
         />

        <!-- Create right menu entry to see generated files -->
        <act_window name="Generated HSBC files"
            domain="[('payment_order_ids', '=', active_id)]"
            res_model="banking.export.hsbc"
            src_model="payment.order"
            view_type="form"
            view_mode="tree,form"
            id="act_banking_export_hsbc_payment_order"/>

    </data>
</openerp>
