diff options
| author | RomainLibert <rli@odoo.com> | 2019-04-05 16:20:52 +0200 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2019-05-31 10:21:21 +0200 |
| commit | 1044a0e889c8a04811734ebe75843a6e6117acf9 (patch) | |
| tree | cc166899c15881c8fbaa330c76658e8c3e009b79 /addons/hr_contract/models | |
| parent | 1594f827802e41823ce04b3c0e5c441d9c91762c (diff) | |
[IMP] hr_contract: Adapt module with new hr.employee.public model
Diffstat (limited to 'addons/hr_contract/models')
| -rw-r--r-- | addons/hr_contract/models/hr_contract.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/hr_contract/models/hr_contract.py b/addons/hr_contract/models/hr_contract.py index 1fbecc1b114..57612effcb1 100644 --- a/addons/hr_contract/models/hr_contract.py +++ b/addons/hr_contract/models/hr_contract.py @@ -15,7 +15,8 @@ class Employee(models.Model): medic_exam = fields.Date(string='Medical Examination Date', groups="hr.group_hr_user") vehicle = fields.Char(string='Company Vehicle', groups="hr.group_hr_user") contract_ids = fields.One2many('hr.contract', 'employee_id', string='Employee Contracts') - contract_id = fields.Many2one('hr.contract', string='Current Contract', help='Current contract of the employee') + contract_id = fields.Many2one('hr.contract', string='Current Contract', + groups="hr.group_hr_user", help='Current contract of the employee') contracts_count = fields.Integer(compute='_compute_contracts_count', string='Contract Count') def _compute_contracts_count(self): @@ -155,7 +156,7 @@ class Contract(models.Model): def write(self, vals): if vals.get('state') == 'open': for contract in self: - contract.employee_id.contract_id = contract + contract.employee_id.sudo().write({'contract_id': contract.id}) return super(Contract, self).write(vals) @api.multi |
