콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
6443 화면

Hello, 

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

Thanks 

 

아바타
취소

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 


베스트 답변

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,



아바타
취소
관련 게시물 답글 화면 활동
1
6월 18
4091
1
10월 23
1970
1
3월 15
3810
3
5월 25
2263
1
4월 25
1728