[IMP] hr_contract: Adapt module with new hr.employee.public model
This commit is contained in:
committed by
Yannick Tivisse
parent
1594f82780
commit
1044a0e889
@@ -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
|
||||
|
||||
@@ -266,7 +266,7 @@
|
||||
id="hr_menu_contract"
|
||||
name="Contracts"
|
||||
action="action_hr_contract"
|
||||
parent="hr.menu_hr_root"
|
||||
parent="hr.menu_hr_employee_payroll"
|
||||
sequence="4"
|
||||
groups="hr_contract.group_hr_contract_manager"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user