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

瘦欲@ 提交于 2021-02-11 13:07:45

问题


I have a view which inherits from view employee form, with fields from a model I created, but whenever I try to upgrade the module it shows me the ValueError: Field active does not exist error.

Here is the view from which I inherited the employee form.

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

This is the training.log.emp model

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: Field active does not exist

Error context: View training_log_employee_form_inherit [view_id: 373, xml_id: n/a, model: training.log.emp, parent_id: 302]


回答1:


Are you sure you're creating the view for the right model? I would say it has to be hr.employee and not training.log.emp, because you're also inheriting a hr.employee view and you just want to show a one2many field on Employees with relation to your new model training.log.emp.



来源:https://stackoverflow.com/questions/58765016/how-to-fix-valueerror-field-active-does-not-exist-in-odoo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!