<odoo>
    <record id="view_account_asset_compute_batch_form" model="ir.ui.view">
        <field name="name">account.asset.compute.batch.form</field>
        <field name="model">account.asset.compute.batch</field>
        <field name="priority">10</field>
        <field name="arch" type="xml">
            <form string="Asset Compute Batch">
                <header>
                    <button
                        name="action_compute"
                        type="object"
                        string="Compute"
                        invisible="state != 'draft'"
                        class="oe_highlight"
                    />
                    <field
                        name="state"
                        widget="statusbar"
                        statusbar_visible="draft,computed"
                    />
                </header>
                <sheet>
                    <div class="oe_button_box" name="button_box">
                        <button
                            name="open_moves"
                            icon="fa-bars"
                            class="oe_stat_button"
                            string="Journal Entries"
                            type="object"
                        />
                        <button
                            name="open_move_lines"
                            icon="fa-bars"
                            class="oe_stat_button"
                            string="Depreciations"
                            type="object"
                        />
                    </div>
                    <div class="oe_title">
                        <h1>
                            <field name="name" required="1" readonly="state != 'draft'" />
                        </h1>
                    </div>
                    <group name="main_group">
                        <group>
                            <field name="description" required="1" readonly="state != 'draft'" />
                            <field name="date_end" required="1" readonly="state != 'draft'" />
                            <field name="auto_compute" readonly="state != 'draft'" />
                            <field name="delay_post" readonly="state != 'draft'" />
                        </group>
                        <group>
                            <field
                                name="company_id"
                                groups="base.group_multi_company"
                                readonly="1"
                            />
                            <field name="profile_ids" widget="many2many_tags" required="1" readonly="state != 'draft'" />
                        </group>
                    </group>
                    <notebook>
                        <page string="Depreciation By Profile" name="profile_report">
                            <field name="profile_report" readonly="1">
                                <list>
                                    <field name="profile_id" />
                                    <field name="currency_id" column_invisible="1" />
                                    <field name="amount" />
                                </list>
                            </field>
                            <group class="oe_subtotal_footer oe_right">
                                <field name="currency_id" invisible="1" />
                                <div class="oe_subtotal_footer_separator oe_inline">
                                    <label for="depre_amount" />
                                </div>
                                <field
                                    name="depre_amount"
                                    nolabel="1"
                                    class="oe_subtotal_footer_separator"
                                />
                            </group>
                        </page>
                        <page string="Exception" name="exception" invisible="state != 'exception'">
                            <field name="note" readonly="1" />
                        </page>
                    </notebook>
                </sheet>
                <chatter />
            </form>
        </field>
    </record>

    <record id="view_account_asset_compute_batch_list" model="ir.ui.view">
        <field name="name">account.asset.compute.batch.list</field>
        <field name="model">account.asset.compute.batch</field>
        <field name="arch" type="xml">
            <list>
                <field name="name" />
                <field name="description" />
                <field name="date_end" />
                <field name="profile_ids" widget="many2many_tags" optional="hide" />
                <field name="depre_amount" sum="Total" />
                <field
                    name="state"
                    widget="badge"
                    decoration-info="state == 'draft'"
                    decoration-success="state == 'computed'"
                    decoration-danger="state == 'exception'"
                />
                <field name="company_id" groups="base.group_multi_company" />
            </list>
        </field>
    </record>
    <record id="search_account_asset_compute_batch_filter" model="ir.ui.view">
        <field name="name">search.account.asset.compute.batch.filter</field>
        <field name="model">account.asset.compute.batch</field>
        <field name="arch" type="xml">
            <search string="Asset Compute Batch">
                <field
                    name="name"
                    string="Batch Number"
                    filter_domain="[('name', 'ilike', self)]"
                />
            </search>
        </field>
    </record>

    <record id="account_asset_compute_batch_action" model="ir.actions.act_window">
        <field name="name">Compute Asset Batch</field>
        <field name="res_model">account.asset.compute.batch</field>
        <field name="view_mode">list,form</field>
        <field name="view_id" ref="view_account_asset_compute_batch_list" />
        <field name="search_view_id" ref="search_account_asset_compute_batch_filter" />
    </record>

    <menuitem
        id="account_asset_compute_batch_menu"
        action="account_asset_compute_batch_action"
        parent="account_asset_management.menu_finance_assets"
        sequence="200"
    />
</odoo>
