<?xml version="1.0" encoding="utf-8"?>
<odoo>
        <record id="wizard_select_template" model="ir.ui.view">
            <field name="name">Select Move Template</field>
            <field name="model">wizard.select.move.template</field>
            <field name="arch" type="xml">
                <form string="Move Template" >
                    <field name="state" invisible="1"/>
                    <group>
                        <group>
                            <field name="template_id" widget="selection"
                                   attrs="{'invisible':[('state','=','template_selected')]}"/>
                        </group>
                        <group>
                            <field name="partner_id" attrs="{'invisible':[('state','=','template_selected')]}"/>
                        </group>
                    </group>
                    <separator
                            string="Modify the lines before create them or edit them after creation."
                            attrs="{'invisible':[('state','!=','template_selected')]}"/>
                    <field name="line_ids" nolabel="1" attrs="{'invisible':[('state','!=','template_selected')]}"/>
                    <footer>
                        <button name="load_template" class="btn-primary" string="Load" type="object" colspan="1" attrs="{'invisible':[('state','!=','template_selected')]}" />
                        <button name="load_lines" class="btn-primary" string="Next" type="object" attrs="{'invisible':[('state','=','template_selected')]}" />
                        <button special="cancel" string="Cancel" class="btn-default"/>
                    </footer>
                </form>
            </field>
        </record>

        <record id="wizard_select_template_line" model="ir.ui.view">
            <field name="name">Select Move Template Line</field>
            <field name="model">wizard.select.move.template.line</field>
            <field name="arch" type="xml">
                <form string="Move Template Line">
                    <group>
                        <field name="sequence" invisible="1"/>
                        <field name="name" />
                        <field name="account_id" />
                        <field name="move_line_type" />
                        <field name="amount" />
                    </group>
                </form>
            </field>
        </record>

        <record id="wizard_select_template_line_tree" model="ir.ui.view">
            <field name="name">Select Move Template Line</field>
            <field name="model">wizard.select.move.template.line</field>
            <field name="arch" type="xml">
                <tree string="Move Template Line" editable="bottom">
                    <field name="sequence" invisible="1"/>
                    <field name="name" />
                    <field name="account_id" />
                    <field name="move_line_type" />
                    <field name="amount" />
                </tree>
            </field>
        </record>

        <record id="action_wizard_select_template" model="ir.actions.act_window">
            <field name="name">Select Move Template</field>
            <field name="res_model">wizard.select.move.template</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="view_id" ref="wizard_select_template"/>
            <field name="target">new</field>
        </record>

       <act_window name="Create Move from Template"
            res_model="wizard.select.move.template"
            src_model="account.move"
            view_mode="form"
            target="new"
            key2="client_action_multi"
            id="action_wizard_select_template_by_move"
            view_id="wizard_select_template"/>

        <menuitem name="Create Move from Template" action="action_wizard_select_template" id="menu_action_wizard_select_template" sequence="10" parent="account.menu_finance_entries"/>
</odoo>
