Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
6111 Lượt xem

Hello, 

I have created a boolean filed in Res.company and I want to use the same filed of  hr.employee.

Thanks 

 

Ảnh đại diện
Huỷ bỏ

Hello Mehta,

 Thanks for the answer.

I try your code

my_filed_emp = fields.Boolean(string='  ',related='company_id.my_filed_com') 
i only have another boolean filed, the fields are not related.

Thanks 


Câu trả lời hay nhất

Hello el mehdi,


First You can add field in res.company using _inherit

You can inherit the hr.employee model and add boolean field which is related to company.

Ex:-


class Company(models.Model):
     _inherit = 'res.company'

     boolean_field_com = fields.Boolean('Boolean String Company')


class Employees(models.Model):

     _inherit = 'hr.employee'

     boolean_field_emp = fields.Boolean('Boolean String Employee', related='company_id.boolean_field_com')


Hope it works for you.

Thanks,



Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 6 18
3856
1
thg 10 23
1746
1
thg 3 15
3589
3
thg 5 25
1723
1
thg 4 25
1286