Odoo - 如何将BASE Salary结构作为数据继承并向其添加新的薪资规则

时间:2016-04-30 15:00:39

标签: xml openerp odoo-8

我需要在Salary文件的Base中添加新的data.xml规则,以便我可以计算总配额和扣除额。 最终输出应如下所示:

this

这是我的代码:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data noupdate="1">
        <record id="ALLOWANCES" model="hr.salary.rule.category">
            <field name="name">Allowances</field>
            <field name="code">ALLOWANCES</field>
        </record>
        <record id="DEDUCTIONS" model="hr.salary.rule.category">
            <field name="name">Deductions</field>
            <field name="code">DEDUCTIONS</field>
        </record>
        <record id="hr_rule_allowances" model="hr.salary.rule">
            <field name="name">Allowances</field>
            <field name="sequence" eval="99"/>
            <field name="code">ALLOWANCES</field>
            <field name="category_id" ref="hr_wps.ALLOWANCES"/>
            <field name="condition_select">none</field>
            <field name="amount_select">code</field>
            <field name="amount_python_compute">result = categories.ALW</field>
        </record>
        <record id="hr_rule_deductions" model="hr.salary.rule">
            <field name="name">Deductions</field>
            <field name="sequence" eval="199"/>
            <field name="code">DEDUCTIONS</field>
            <field name="category_id" ref="hr_wps.DEDUCTIONS"/>
            <field name="condition_select">none</field>
            <field name="amount_select">code</field>
            <field name="amount_python_compute">result = categories.DED</field>
        </record>

        <!-- Salary Structure -->

         <record id="structure_base_extend" model="hr.payroll.structure">
            <field name="code">BASE</field>
            <field name="name">Base for new structures</field>
            <field name="inherit_id" ref="hr_payroll.structure_base"/>
            <field eval="[(6, 0, [ref('hr_rule_allowances'), ref('hr_rule_deductions')])]" name="rule_ids"/>
        </record>

但是我收到了这个错误:

  

ParseError:&#34;系统中找不到外部ID:hr_payroll.ALLOWANCES&#34;解析/home/youta/odoo-8/my_addons/hr_wps/wps_data.xml:15,附近&#39;&#39;

当我试图删除此行时

<field name="category_id" ref="hr_payroll.ALLOWANCES"/>

我收到另一个错误category_id不能NULL

任何帮助将不胜感激。感谢。

解决了上述问题之后..现在我得到的是创建重复的BASE薪资规则,仅使用新的两行,而不是添加到原始BASE。如何继承BASE结构而不是创建新结构。

0 个答案:

没有答案
相关问题