[FIX] hr : job position, bad computation of employee field
lp bug: https://launchpad.net/bugs/893626 fixed bzr revid: mdi@tinyerp.com-20111124101209-frhh1qyzvhrarq6s
This commit is contained in:
parent
9e34f30b75
commit
855a4bcb52
|
@ -79,12 +79,27 @@ class hr_job(osv.osv):
|
|||
}
|
||||
return res
|
||||
|
||||
def _get_job_position(self, cr, uid, ids, context=None):
|
||||
result = {}
|
||||
for data in self.pool.get('hr.employee').browse(cr, uid, ids, context=context):
|
||||
if data.job_id:
|
||||
result[data.job_id.id] = True
|
||||
return result.keys()
|
||||
|
||||
_name = "hr.job"
|
||||
_description = "Job Description"
|
||||
_columns = {
|
||||
'name': fields.char('Job Name', size=128, required=True, select=True),
|
||||
'expected_employees': fields.function(_no_of_employee, string='Expected Employees', help='Required number of Employees in total for that job.', multi="no_of_employee", store=True),
|
||||
'no_of_employee': fields.function(_no_of_employee, string="No of Employee", help='Number of employee with that job.', multi="no_of_employee", store=True),
|
||||
'expected_employees': fields.function(_no_of_employee, string='Expected Employees', help='Required number of Employees in total for that job.',
|
||||
store={
|
||||
'hr.employee': (_get_job_position, ['job_id'], 10),
|
||||
},
|
||||
multi='no_of_employee'),
|
||||
'no_of_employee': fields.function(_no_of_employee, string="No of Employee", help='Number of employee with that job.',
|
||||
store={
|
||||
'hr.employee': (_get_job_position, ['job_id'], 10),
|
||||
},
|
||||
multi='no_of_employee'),
|
||||
'no_of_recruitment': fields.float('Expected in Recruitment'),
|
||||
'employee_ids': fields.one2many('hr.employee', 'job_id', 'Employees'),
|
||||
'description': fields.text('Job Description'),
|
||||
|
@ -98,7 +113,7 @@ class hr_job(osv.osv):
|
|||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr.job', context=c),
|
||||
'state': 'open',
|
||||
}
|
||||
|
||||
|
||||
_sql_constraints = [
|
||||
('name_company_uniq', 'unique(name, company_id)', 'The name of the job position must be unique per company!'),
|
||||
]
|
||||
|
@ -242,7 +257,7 @@ class res_users(osv.osv):
|
|||
|
||||
def create(self, cr, uid, data, context=None):
|
||||
user_id = super(res_users, self).create(cr, uid, data, context=context)
|
||||
|
||||
|
||||
# add shortcut unless 'noshortcut' is True in context
|
||||
if not(context and context.get('noshortcut', False)):
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
|
@ -254,7 +269,7 @@ class res_users(osv.osv):
|
|||
except:
|
||||
# Tolerate a missing shortcut. See product/product.py for similar code.
|
||||
logging.getLogger('orm').debug('Skipped meetings shortcut for user "%s"', data.get('name','<new'))
|
||||
|
||||
|
||||
return user_id
|
||||
|
||||
res_users()
|
||||
|
|
Loading…
Reference in New Issue