1

所以我试图在odoo中继承hr.employee,但是有一个错误,我不知道为什么,因为我像在教程中那样做。(链接到教程

这是我的代码:在

员工.py

class Employee(models.Model):
""" Class Employee """
_inherit = 'hr.employee'
_description = 'A custom class of employee'

esia = fields.Float(digits=(12, 2))
cnaps = fields.Float(digits=(12, 2))

员工.xml

<record model="ir.ui.view" id="employee_form_view">
    <field name="name">employee.form</field>
    <field name="model">hr.employee</field>
    <field name="inherit_id" ref="hr.view_employee_form"/>
    <field name="arch" type="xml">
        <notebook position="inside">
            <page string="Sécurité Sociale">
                <group>
                    <field name="cnaps"/>
                    <field name="esia"/>
                </group>
            </page>
        </notebook>
    </field>
</record>
<record model="ir.actions.act_window" id="employee_list_action">
    <field name="name">Employees</field>
    <field name="res_model">hr.employee</field>
    <field name="view_mode">tree,form</field>
</record>

尝试升级模块时出现的错误是:

Invalid model name 'hr.employee' in action definition
4

1 回答 1

3

感谢@Amal,我在其中定义了 hr 模块,_manifest_.py然后它就起作用了。在此处添加hr'depends': ['base', 'hr'],

于 2019-04-03T08:42:58.910 回答