fix jobs
This commit is contained in:
parent
e1ba40b279
commit
5d2acb08a3
|
|
@ -766,6 +766,11 @@ class HrJob(models.Model):
|
|||
description = fields.Html(string="Job Description")
|
||||
english_name = fields.Char(string='English Name')
|
||||
|
||||
@api.depends('no_of_recruitment', 'employee_ids.job_id', 'employee_ids.active','employee_ids.state')
|
||||
def _compute_employees(self):
|
||||
for rec in self:
|
||||
super(Job,rec)._compute_employees()
|
||||
|
||||
|
||||
class AddressCity(models.Model):
|
||||
_name = "address.city"
|
||||
|
|
|
|||
|
|
@ -40,14 +40,14 @@ class HrJob(models.Model):
|
|||
help='Number of new employees you expect to recruit.', default=1)
|
||||
job_request_ids = fields.One2many('hr.job.request', 'job_id', string="Job Requests")
|
||||
|
||||
@api.depends('employee_ids.job_id', 'employee_ids.active', 'employee_ids.state')
|
||||
@api.depends('no_of_recruitment','employee_ids.job_id', 'employee_ids.active', 'employee_ids.state')
|
||||
def _compute_employees(self):
|
||||
employee_data = self.env['hr.employee'].read_group([('job_id', 'in', self.ids), ('state', '=', 'open')],
|
||||
['job_id'], ['job_id'])
|
||||
result = dict((data['job_id'][0], data['job_id_count']) for data in employee_data)
|
||||
for job in self:
|
||||
job.no_of_employee = result.get(job.id, 0)
|
||||
# job.expected_employees = result.get(job.id, 0) + job.no_of_recruitment
|
||||
job.expected_employees = result.get(job.id, 0) + job.no_of_recruitment
|
||||
|
||||
@api.depends('no_of_recruitment')
|
||||
def get_no_job(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue