Skip to Content
Menú
This question has been flagged
3 Respostes
6175 Vistes

H, i'd like to know how to add the hr.job field from hr.employee to project.issue kanban view.

I tried this in the model.py

class hr_employee(models.Model):
_inherit = "hr.employee"
job_id = fields.Many2one('hr.job', 'Job title')

but when defining the field in the view

<field name="job_id"/> 

 I get  

"Error details:
Field `job_id` does not exist"

I created an inherited view of the original issue kanban view

<field name="inherit_id" ref="project_issue.project_issue_kanban_view"/> 


Where else should it be defined or what exactly am I missing here?
Help appreciated.


Avatar
Descartar
Best Answer

Hi Oskar Must,

You are adding new field inside the employee table instead of project issue table.

Correct the model name in inherited class.

instead of

_inherit = 'hr.employee'  #wrong model used.

It must be:

_inherit = 'project.issue'  #This is correct model

As you have inherited the view of project.issue model.

This would be your code:

class project_issue(models.Model):
_inherit = "project.issue"
    job_id = fields.Many2one('hr.job', 'Job title')

 

Hope this would helps you.

Rgds,

Anil.



Avatar
Descartar
Best Answer

Hi Oskar,

You are making wrong inheritence.

You should take inherit class name project.issue instead of hr.employee.

class hr_employee(models.Model):

_inherit = "hr.employee"

job_id = fields.Many2one('hr.job', 'Job title')

It will work

Avatar
Descartar
Autor Best Answer

Hi Akhilesh & Anil, 

Thank you both, I got it working now :)

Much simpler than I expected too.

(Couldn't write this as a comment on your answers, not enough karma)

Avatar
Descartar
Related Posts Respostes Vistes Activitat
0
de set. 15
47
3
d’abr. 23
17703
1
de març 15
12163
2
de nov. 22
10058
1
de maig 21
6581