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

    <record id="view_tax_unit_form" model="ir.ui.view">
        <field name="name">account.tax.unit.form</field>
        <field name="model">account.tax.unit</field>
        <field name="arch" type="xml">
            <form string="Tax Unit">
                <div class="alert alert-info" role="alert"
                     invisible="fpos_synced">
                    Fiscal Positions should apply to all companies of the tax unit. You may want to <button class="oe_link p-0 align-baseline" type="object" name="action_sync_unit_fiscal_positions">synchronize fiscal positions</button>.
                </div>
                <sheet>
                    <field name="fpos_synced" invisible="1"/>
                    <div class="oe_title">
                        <h1>
                            <field name="name" placeholder="Name"/>
                        </h1>
                    </div>

                    <group>
                        <group>
                            <field name="country_id" options="{'no_create': True, 'no_open': True}"/>
                            <field name="company_ids" widget="many2many_tags" domain="[('chart_template', '!=', False), ('account_tax_unit_ids', '=', False)]" options="{'no_create': True}"/>
                            <field name="main_company_id" domain="[('id', 'in', company_ids)]" options="{'no_create': True, 'no_open': True}"/>
                        </group>
                        <group>
                            <field name="vat"/>
                        </group>
                    </group>
                    <group>

                    </group>
                </sheet>
            </form>
        </field>
    </record>

    <record id="view_tax_unit_tree" model="ir.ui.view">
        <field name="name">account.tax.unit.list</field>
        <field name="model">account.tax.unit</field>
        <field name="arch" type="xml">
            <list>
                <field name="name"/>
                <field name="country_id"/>
            </list>
        </field>
    </record>

    <record id="action_view_tax_units" model="ir.actions.act_window">
        <field name="name">Tax Units</field>
        <field name="res_model">account.tax.unit</field>
        <field name="view_mode">list,form</field>
        <field name="view_id" ref="view_tax_unit_tree"/>
    </record>

    <menuitem
        id="menu_view_tax_units"
        action="action_view_tax_units"
        parent="account.account_account_menu"
        sequence="8"
        groups="base.group_no_one"/>

</odoo>
