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

        <!-- List view -->
        <record id="view_account_move_template_tree" model="ir.ui.view">
            <field name="name">account.move.template.list</field>
            <field name="model">account.move.template</field>
            <field name="arch" type="xml">
                <list>
                    <field name="name"/>
                    <field name="description"/>
                    <field name="tag_ids" widget="many2many_tags"/>
                </list>
            </field>
        </record>

        <!-- Form view -->
        <record id="view_account_move_template_form" model="ir.ui.view">
            <field name="name">account.move.template.form</field>
            <field name="model">account.move.template</field>
            <field name="arch" type="xml">
                <form>
                    <sheet>
                        <div class="oe_title">
                            <label for="name"/>
                            <h1>
                                <field name="name" placeholder="Название шаблона"/>
                            </h1>
                        </div>
                        <group>
                            <field name="description"/>
                            <field name="tag_ids" widget="many2many_tags"/>
                        </group>
                        <notebook>
                            <page string="Строки шаблона" name="lines">
                                <field name="line_ids">
                                    <list editable="bottom">
                                        <field name="account_id"/>
                                        <field name="move_type"/>
                                        <field name="percent"/>
                                        <field name="line_type"/>
                                    </list>
                                </field>
                            </page>
                        </notebook>
                    </sheet>
                </form>
            </field>
        </record>

        <!-- Search view -->
        <record id="view_account_move_template_search" model="ir.ui.view">
            <field name="name">account.move.template.search</field>
            <field name="model">account.move.template</field>
            <field name="arch" type="xml">
                <search>
                    <field name="name" string="Название"/>
                    <field name="tag_ids" string="Признак"/>
                    <filter name="group_by_tag" string="По признаку" context="{'group_by': 'tag_ids'}"/>
                </search>
            </field>
        </record>

        <!-- Action -->
        <record id="action_account_move_template" model="ir.actions.act_window">
            <field name="name">Шаблоны типовых операций</field>
            <field name="res_model">account.move.template</field>
            <field name="view_mode">list,form</field>
            <field name="search_view_id" ref="view_account_move_template_search"/>
        </record>

        <!-- Menu item under Accounting → Configuration -->
        <menuitem
            id="menu_account_move_template"
            name="Шаблоны типовых операций"
            parent="account.menu_finance_configuration"
            action="action_account_move_template"
            sequence="100"/>

    </data>
</odoo>
