commit
0ae332eea0
|
|
@ -252,21 +252,7 @@ class HrEmployee(models.Model):
|
|||
|
||||
@api.model
|
||||
def _default_emp_code(self):
|
||||
seq = self.env['ir.sequence'].next_by_code('hr.employee') or '/'
|
||||
emp_seq = self.env['hr.employee'].search([('active', 'in', [False, True])])
|
||||
|
||||
# Get the maximum current employee number
|
||||
max_number = 0
|
||||
if emp_seq:
|
||||
max_number = max(int(emp.emp_no) for emp in emp_seq if emp.emp_no and emp.emp_no.isdigit())
|
||||
|
||||
# Ensure the sequence matches the max number + 1
|
||||
if int(seq) != (max_number + 1):
|
||||
currnt_sequence = self.env['ir.sequence'].search([('code', '=', 'hr.employee')], limit=1)
|
||||
currnt_sequence.write({'number_next_actual': max_number + 1})
|
||||
seq = self.env['ir.sequence'].next_by_code('hr.employee') or '/'
|
||||
|
||||
return str(seq)
|
||||
return "1"
|
||||
|
||||
@api.depends('new_gosi')
|
||||
def _compute_gosi_years(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue