Skip to Content
Menú
This question has been flagged
2 Respostes
6028 Vistes

Hello, 

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

Thanks 

 

Avatar
Descartar

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 


Best Answer

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,



Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
de juny 18
3811
1
d’oct. 23
1703
1
de març 15
3554
3
de maig 25
1623
1
d’abr. 25
1228