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

        <record model="ir.actions.server" id="action_pe_salary_rule_account_set">
            <field name="name">Peru Default Accounting</field>
            <field name="model_id" ref="hr_payroll.model_hr_salary_rule"/>
            <field name="binding_model_id" ref="hr_payroll.model_hr_salary_rule" />
            <field name="state">code</field>
            <field name="code">
                if records:
                    companies = env.user.company_ids
                    # You can override the account codes with kwargs like:
                    # pay_ee='1234',
                    # pay_afp='1235',
                    # pay_onp='1236',
                    # pay_ir_4ta_cat='2222',
                    # pay_ir_5ta_cat='1238',
                    # pay_essalud='1239',
                    # exp_salary='1240',
                    # exp_com='1222',
                    # exp_bono='1223',
                    # exp_essalud='1241',
                    # exp_gratif='1245',
                    env['account.chart.template']._pe_configure_payroll_account_data(companies, salary_rules=records, full_reset=False)
            </field>
        </record>

        <record model="ir.actions.server" id="action_pe_salary_rule_account_reset">
            <field name="name">Peru Default Accounting (Reset)</field>
            <field name="model_id" ref="hr_payroll.model_hr_salary_rule"/>
            <field name="binding_model_id" ref="hr_payroll.model_hr_salary_rule" />
            <field name="state">code</field>
            <field name="code">
                if records:
                    companies = env.user.company_ids
                    # You can override the account codes with kwargs like:
                    # pay_ee='1234',
                    # pay_afp='1235',
                    # pay_onp='1236',
                    # pay_ir_4ta_cat='2222',
                    # pay_ir_5ta_cat='1238',
                    # pay_essalud='1239',
                    # exp_salary='1240',
                    # exp_com='1222',
                    # exp_bono='1223',
                    # exp_essalud='1241',
                    # exp_gratif='1245',
                    env['account.chart.template']._pe_configure_payroll_account_data(companies, salary_rules=records, full_reset=True)
            </field>
        </record>

    </data>
</odoo>
