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

    <!-- Tax Yearly Rates Tree View -->
    <record id="tax_rates_tree_view" model="ir.ui.view">
        <field name="name">tax.rates.tree.view</field>
        <field name="model">tax.yearly.rates</field>
        <field name="priority">16</field>
        <field name="arch" type="xml">
            <list string="Tax Lines">
                <field name="fiscal_year"/>
                <field name="tax_type"/>
                <field name="ded_type"/>
            </list>
        </field>
    </record>

    <!-- Tax Yearly Rates Form View -->
    <record id="tax_rates_form_view" model="ir.ui.view">
        <field name="name">tax.rates.form.view</field>
        <field name="model">tax.yearly.rates</field>
        <field name="priority">16</field>
        <field name="arch" type="xml">
            <form>
                <sheet>
                    <field name="fiscal_year" required="1"/>
                    
                    <!-- Canada Pension Plan Section -->
                    <group name="Canada Pension Plan">
                        <field name="ded_type" invisible="ded_type not in ['cpp']"/>
                        <group name="CPP" invisible="ded_type not in ['cpp']">
                            <separator string="Canadian Pension Plan"/>
                            <field name="emp_contribution_rate"/>
                            <field name="employer_contribution_rate"/>
                            <field name="exemption"/>
                            <field name="max_cpp"/>
                        </group>
                    </group>
                    
                    <!-- Employment Insurance Section -->
                    <group name="ei">
                        <field name="ded_type" invisible="ded_type not in ['ei']"/>
                        <group name="emp_ins" invisible="ded_type not in ['ei']">
                            <separator string="Employment Insurance"/>
                            <field name="ei_earnings"/>
                            <field name="emp_ei_amount"/>
                            <field name="employer_ei_amount"/>
                            <field name="ei_rate"/>
                        </group>
                    </group>
                    
                    <!-- Tax Brackets Section -->
                    <group name="test">
                        <group name="testing" invisible="not tax_type">
                            <separator string="Taxes"/>
                            <field name="tax_type"/>
                            <field name="tax_yearly_rate_ids">
                                <list editable="bottom">
                                    <field name="tax_bracket" required="1"/>
                                    <field name="tax_rate" required="1"/>
                                    <field name="tax_constant" required="1"/>
                                </list>
                            </field>
                            <field name="canada_emp_amount" required="1" 
                                   invisible="tax_type not in ['federal'] and ded_type not in ['cpp','ei']"/>
                        </group>
                    </group>
                </sheet>
            </form>
        </field>
    </record>

    <!-- Actions and Menus moved to fusion_payroll_menus.xml -->

</odoo>
