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

Xml Odoo-如何将基本薪资结构作为数据继承并向其中添加新的薪资规则,xml,openerp,odoo-8,Xml,Openerp,Odoo 8,我需要在data.xml文件的Base中添加一个新的Salary规则,以便计算津贴和扣减总额。 最终输出应如下所示: 这是我的密码: <?xml version="1.0" encoding="utf-8"?> <openerp> <data noupdate="1"> <record id="ALLOWANCES" model="hr.salary.rule.category"> <fiel

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

这是我的密码:

<?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>

津贴
津贴
扣除
扣除
津贴
津贴
没有一个
代码
结果=categories.ALW
扣除
扣除
没有一个
代码
结果=categories.DED
基础
新结构的基础
但我得到了这个错误:

ParseError:解析/home/youta/odoo-8/my_addons/hr_wps/wps_data时,系统中未找到外部ID:hr_payroll.offensions。xml:15,靠近“”

当我试图抹去这条线的时候

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

我收到另一个错误,
category\u id
不能为
NULL

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


在解决了上述问题后。。现在,我得到的是创建了重复的基本工资规则,只包含新的两行,而不是添加到原始的基本工资中。我如何继承基本结构而不是创建新结构。

我找到了一个答案问题出在我的代码中而不是
我应该用我的模块名替换ref。。它应该是这样的
正确,当它在您的模块中时,您也可以省略模块名称。但是要注意清单文件(openerp.py)中的数据文件加载顺序。在创建被调用的记录之前不应该有ref调用;-)