<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="l10n_ke_inherit_view_tax_tree" model="ir.ui.view">
        <field name="name">l10n.ke.account.tax.tree</field>
        <field name="model">account.tax</field>
        <field name="inherit_id" ref="account.view_tax_tree" />
        <field name="arch" type="xml">
            <field name="description" position="after">
                <field name="l10n_ke_item_code_id" optional="hide"/>
            </field>
        </field>
    </record>

    <record id="l10n_ke_inherit_view_tax_form" model="ir.ui.view">
        <field name="name">l10n.ke.inherit.account.tax.form</field>
        <field name="model">account.tax</field>
        <field name="inherit_id" ref="account.view_tax_form" />
        <field name="arch" type="xml">
            <xpath expr="//field[@name='country_id']" position="after">
                <field name="l10n_ke_item_code_id"
                       string="KRA Item Code"
                       domain="[] if amount_type != 'percent' else [('tax_rate', 'in', ['C','E'] if amount == 0 else ['B'] if amount == 8 else [False])]"
                       invisible="country_code != 'KE'"/>
            </xpath>
        </field>
    </record>
</odoo>
