[FIX] hr_contract: change the company when changing employee

closes odoo/odoo#37164

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
RomainLibert
2019-09-19 15:37:54 +00:00
parent bea0a9edfe
commit e1eca412fb
+2 -1
View File
@@ -47,7 +47,7 @@ class Contract(models.Model):
* red = Shows a warning on the employees kanban view
"""
kanban_state = fields.Selection([
('normal', 'Grey'),
('normal', 'Grey'),
('done', 'Green'),
('blocked', 'Red')
], string='Kanban State', default='normal', tracking=True)
@@ -74,6 +74,7 @@ class Contract(models.Model):
self.job_id = self.employee_id.job_id
self.department_id = self.employee_id.department_id
self.resource_calendar_id = self.employee_id.resource_calendar_id
self.company_id = self.employee_id.company_id
@api.constrains('employee_id', 'state', 'kanban_state', 'date_start', 'date_end')
def _check_current_contract(self):