Skip to Content
Menu
This question has been flagged
1 Reply
7016 Views

hi all , iam trying to add a extra field in hr_emp module , but when i add the server is not starting it shows me this error


  File "/odoo/odoo-server/odoo/fields.py", line 494, in _setup_related_full

    raise TypeError("Type of related field %s is inconsistent with %s" % (self, field))

TypeError: Type of related field hr.employee.employee_id is inconsistent with resource.resource.name - - -


emp.y:

employee_id = fields.Integer(string="Employee Id",related='resource_id.name', store=True, readonly=False, tracking=True )


emp_views.py:

                            <group>

                                <field name="employee_id" string="Employee Id" required="True"/> 

                            </group>


also when i try with 

employee_id = fields.Char(string="Employee Id", required = True) , it throws me an error than employee id didnt exit in form view



SOMEONE SOLVE THIS  

Avatar
Discard
Best Answer

Hi, Guna

Regarding the above issues:

employee_id = fields.Integer(string="Employee Id",related='resource_id.name', store=True, readonly=False, tracking=True )

Name is a character type field in the Resource model, So you need to replace this line with the below line

employee_id = fields.Char(string="Employee Id",related='resource_id.name', store=True, readonly=False, tracking=True )

After do these changes restart your Odoo server then upgrade your custom module. If you still have the same issue then try to upgrade using command line,

/odoo-bin -c config.py -d databasename -u modulename


Feel free to ask in case you have any confusion related to the above point.


Thanks,
Ashish Singh (Team Lead)
Webkul Software Private Limited
Avatar
Discard