<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <record id="account_move_template_run_form" model="ir.ui.view">
        <field name="model">account.move.template.run</field>
        <field name="arch" type="xml">
            <form string="Journal Entry Template">
                <group name="main">
                    <field name="state" invisible="1" />
                    <field
                        name="template_id"
                        widget="selection"
                        attrs="{'readonly': [('state', '=', 'set_lines')]}"
                    />
                    <field
                        name="overwrite"
                        widget="ace"
                        options="{'mode': 'python'}"
                        attrs="{'invisible': [('state', '=', 'set_lines')]}"
                    />
                    <field name="company_id" invisible="1" />
                    <field name="company_id" groups="base.group_multi_company" />
                    <field name="date" states="set_lines" />
                    <field name="journal_id" states="set_lines" />
                    <field name="ref" states="set_lines" />
                    <field name="partner_id" states="set_lines" />
                </group>
                <group name="lines" states="set_lines">
                    <field name="line_ids" nolabel="1" colspan="2">
                        <tree editable="bottom">
                            <field name="sequence" invisible="1" />
                            <field name="name" />
                            <field
                                name="account_id"
                                domain="[('company_id','=',company_id)]"
                            />
                            <field name="partner_id" />
                            <field
                                name="analytic_distribution"
                                widget="analytic_distribution"
                                groups="analytic.group_analytic_accounting"
                            />
                            <field
                                name="tax_line_id"
                                attrs="{'invisible': [('tax_line_id','=',False)]}"
                            />
                            <field
                                name="tax_ids"
                                widget="many2many_tags"
                                attrs="{'invisible': [('tax_ids','=',[])]}"
                            />
                            <field name="move_line_type" />
                            <field name="amount" />
                            <field name="note" />
                            <field name="payment_term_id" />
                            <field name="company_id" invisible="1" />
                            <field name="company_currency_id" invisible="1" />
                        </tree>
                    </field>
                </group>
                <footer>
                    <button
                        name="load_lines"
                        class="btn-primary"
                        string="Next"
                        type="object"
                        states="select_template"
                    />
                    <button
                        name="generate_move"
                        class="btn-primary"
                        string="Create Journal Entry"
                        type="object"
                        states="set_lines"
                    />
                    <button special="cancel" string="Cancel" class="btn-default" />
                </footer>
            </form>
        </field>
    </record>
    <record id="account_move_template_run_action" model="ir.actions.act_window">
        <field name="name">Create Entry from Template</field>
        <field name="res_model">account.move.template.run</field>
        <field name="view_mode">form</field>
        <field name="target">new</field>
    </record>
    <menuitem
        id="account_move_template_run_menu"
        parent="account.menu_finance_entries_actions"
        action="account_move_template_run_action"
        sequence="10"
    />
</odoo>
