<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (C) 2019 - Today: GRAP (http://www.grap.coop)
Copyright (C) 2021 - Today: Odoo SA
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

    <record id="view_account_chart_template_form" model="ir.ui.view">
        <field name="model">account.chart.template</field>
        <field name="arch" type="xml">
            <form>
                <group col="4">
                    <field name="name" />
                    <field name="parent_id" />
                    <field name="bank_account_code_prefix" />
                    <field name="cash_account_code_prefix" />
                    <field name="transfer_account_code_prefix" />
                    <field name="code_digits" />
                    <field name="visible" />
                    <field name="use_storno_accounting" />
                </group>
                <separator string="Default Taxes" colspan="4" />
                <field name="tax_template_ids" colspan="4" nolabel="1" />
                <separator string="Properties" colspan="4" />
                <group col="4">
                    <field name="property_account_receivable_id" />
                    <field name="property_account_payable_id" />
                    <field name="property_account_expense_categ_id" />
                    <field name="property_account_income_categ_id" />
                    <field name="property_account_expense_id" />
                    <field name="property_account_income_id" />
                    <field name="account_journal_early_pay_discount_loss_account_id" />
                    <field name="account_journal_early_pay_discount_gain_account_id" />
                </group>
            </form>
        </field>
    </record>

    <record id="view_account_chart_template_tree" model="ir.ui.view">
        <field name="model">account.chart.template</field>
        <field name="arch" type="xml">
            <tree>
                <field name="name" />
                <field name="property_account_receivable_id" invisible="1" />
                <field name="property_account_payable_id" invisible="1" />
                <field name="property_account_expense_categ_id" invisible="1" />
                <field name="property_account_income_categ_id" invisible="1" />
            </tree>
        </field>
    </record>

    <record id="view_account_chart_template_seacrh" model="ir.ui.view">
        <field name="model">account.chart.template</field>
        <field name="arch" type="xml">
            <search>
                <field name="name" string="Account Template" />
                <field name="bank_account_code_prefix" />
                <field name="cash_account_code_prefix" />
                <field name="transfer_account_code_prefix" />
                <group expand="0" string="Group By">
                    <filter
                        string="Receivable Account"
                        name="receivalbeacc"
                        domain="[]"
                        context="{'group_by':'property_account_receivable_id'}"
                    />
                    <filter
                        string="Payable Account"
                        name="payableacc"
                        domain="[]"
                        context="{'group_by':'property_account_payable_id'}"
                    />
                    <filter
                        string="Income Account"
                        name="incomeacc"
                        domain="[]"
                        context="{'group_by':'property_account_income_categ_id'}"
                    />
                    <filter
                        string="Expense Account"
                        name="expenseacc"
                        domain="[]"
                        context="{'group_by':'property_account_expense_categ_id'}"
                    />
                </group>
            </search>
        </field>
    </record>


    <record id="action_account_chart_template_form" model="ir.actions.act_window">
        <field name="name">Chart of Accounts Templates</field>
        <field name="res_model">account.chart.template</field>
        <field name="view_mode">tree,form</field>
    </record>

    <menuitem
        id="menu_account_chart_template"
        action="action_account_chart_template_form"
        parent="menu_account_coa_settings"
        sequence="10"
    />
</odoo>
