Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
6231 มุมมอง

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.


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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.



อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

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)

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ก.ย. 15
47
Change default view for Projects แก้ไขแล้ว
3
เม.ย. 23
17748
1
มี.ค. 15
12203
2
พ.ย. 22
10211
Add a field to CRM Kanban View - Inherit แก้ไขแล้ว
1
พ.ค. 21
6654