Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3 Antwoorden
6223 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Beste antwoord

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
Annuleer
Auteur Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
0
sep. 15
47
3
apr. 23
17746
1
mrt. 15
12193
2
nov. 22
10195
1
mei 21
6647