How to fix ValueError: Field `active` does not exist in odoo

How to fix ValueError: Field `active` does not exist in odoo

我有一个视图继承自视图员工表单,其中包含我创建的模型中的字段,但每当我尝试升级模块时,它都会向我显示 ValueError: Field active 不存在错误。

这是我从中继承员工表单的视图。

<record model="ir.ui.view" id="training_log_employee_form_inherit">
        <field name="name">training.log.employee.form.inherit</field>
        <field name="model">training.log.emp</field>
        <field name="inherit_id" ref="hr.view_employee_form"/>
        <field name="arch" type="xml">
           <xpath expr="//notebook" position="inside">
              <page string="Training Log">
                <field name="training_log_line">
                  <form>
                    <group string="Employee Training">
                      <field name="date"/>
                      <field name="course"/>
                      <field name="type_list"/>
                      <field name="completion_status"/>
                    </group>
                  </form>
                    <tree editable="bottom">
                      <field name="date"/>
                      <field name='course'/>
                      <field name="type_list"/>
                      <field name="completion_status"/>
                    </tree>
                  </field>       
                </page>

            </xpath>

        </field>
      </record>

这是training.log.emp模型

class TrainingLog(models.Model):
    _name = 'training.log.emp'

    hr_employee = fields.Many2one('hr.employee')
    date = fields.Date()
    course = fields.Char()
    type_list = fields.Many2one('Type', 'hr.training.log')
    completion_status = fields.Selection([
        ('done', 'Done'),
        ('in_view', 'In View'),
        ])

ValueError: 字段 active 不存在

错误上下文: 查看 training_log_employee_form_inherit [view_id: 373, xml_id: n/a, 型号: training.log.emp, parent_id: 302]

您确定您正在为正确的模型创建视图吗?我会说它必须是 hr.employee 而不是 training.log.emp,因为您还继承了一个 hr.employee 视图并且您只想在 Employees 上显示一个与您的新模型相关的 one2many 字段training.log.emp.