res.append(employee.job_id.id)
return res
- def _count_all(self, cr, uid, ids, field_name, arg, context=None):
- res = dict(map(lambda x: (x,{'documents_count': 0, 'application_count': 0,}), ids))
- try:
- for data in self.browse(cr, uid, ids, context=context):
- res[data.id] = {'documents_count': len(data.document_ids),
- 'application_count': len(data.applicant_ids),
- }
- except:
- pass
- return res
-
_name = "hr.job"
_description = "Job Position"
_inherit = ['mail.thread', 'ir.needaction_mixin']
track_visibility='always',
help="By default 'Closed', set it to 'In Recruitment' if recruitment process is going on for this job position."),
'write_date': fields.datetime('Update Date', readonly=True),
- 'applicant_ids':fields.one2many('hr.applicant', 'job_id', 'Applications'),
- 'application_count': fields.function(_count_all, type='integer', string='Applications', multi=True),
- 'document_ids': fields.one2many('ir.attachment', 'company_id', 'Documents'),
- 'documents_count': fields.function(_count_all, type='integer', string='Documents', multi=True),
}
_defaults = {
def _set_image(self, cr, uid, id, name, value, args, context=None):
return self.write(cr, uid, [id], {'image': tools.image_resize_image_big(value)}, context=context)
-
- def _count_all(self, cr, uid, ids, field_name, arg, context=None):
- res = dict(map(lambda x: (x,{'appraisal_count': 0, 'leaves_count': 0, 'contracts_count': 0, 'timesheet_count': 0, 'payslip_count': 0,}), ids))
- try:
- for datas in self.browse(cr, uid, ids, context=context):
- res[datas.id] = {'appraisal_count': len(datas.appraisal_ids),
- 'leaves_count': len(datas.leave_ids),
- 'contracts_count': len(datas.contract_ids),
- 'timesheet_count': len(datas.timsheet_ids),
- 'payslip_count': len(datas.payslip_ids)
- }
- except:
- pass
- return res
_columns = {
#we need a related field in order to be able to sort the employee by name
'city': fields.related('address_id', 'city', type='char', string='City'),
'login': fields.related('user_id', 'login', type='char', string='Login', readonly=1),
'last_login': fields.related('user_id', 'date', type='datetime', string='Latest Connection', readonly=1),
- 'appraisal_ids': fields.one2many('hr.evaluation.interview', 'user_to_review_id', 'Appraisal Interviews'),
- 'leave_ids': fields.one2many('hr.holidays', 'employee_id', 'Leaves'),
- 'contracts_ids': fields.one2many('hr.contract', 'employee_id', 'Contracts'),
- 'timsheet_ids': fields.one2many('hr_timesheet_sheet.sheet', 'employee_id', 'Timesheets'),
- 'payslip_ids': fields.one2many('hr.payslip', 'employee_id', 'Payslips'),
- 'appraisal_count': fields.function(_count_all, type='integer', string='Appraisal Interviews', multi=True),
- 'leaves_count': fields.function(_count_all, type='integer', string='Leaves', multi=True),
- 'contracts_count': fields.function(_count_all, type='integer', string='Contracts', multi=True),
- 'timesheet_count': fields.function(_count_all, type='integer', string='Timsheets', multi=True),
- 'payslip_count': fields.function(_count_all, type='integer', string='Payslips', multi=True),
}
def _get_default_image(self, cr, uid, context=None):
res[emp.id] = False
return res
+ def _contracts_count(self, cr, uid, ids, field_name, arg, context=None):
+ res = dict(map(lambda x: (x,0), ids))
+ try:
+ for employee in self.browse(cr, uid, ids, context=context):
+ res[employee.id] = len(employee.contract_ids)
+ except:
+ pass
+ return res
+
_columns = {
'manager': fields.boolean('Is a Manager'),
'medic_exam': fields.date('Medical Examination Date'),
'vehicle_distance': fields.integer('Home-Work Dist.', help="In kilometers"),
'contract_ids': fields.one2many('hr.contract', 'employee_id', 'Contracts'),
'contract_id':fields.function(_get_latest_contract, string='Contract', type='many2one', relation="hr.contract", help='Latest contract of the employee'),
+ 'contracts_count': fields.function(_contracts_count, type='integer', string='Contracts'),
}
_name = "hr.employee"
_inherit="hr.employee"
+ def _appraisal_count(self, cr, uid, ids, field_name, arg, context=None):
+ res = dict(map(lambda x: (x,0), ids))
+ try:
+ for employee in self.browse(cr, uid, ids, context=context):
+ res[employee.id] = len(employee.appraisal_ids)
+ except:
+ pass
+ return res
_columns = {
'evaluation_plan_id': fields.many2one('hr_evaluation.plan', 'Appraisal Plan'),
'evaluation_date': fields.date('Next Appraisal Date', help="The date of the next appraisal is computed by the appraisal plan's dates (first appraisal + periodicity)."),
+ 'appraisal_ids': fields.one2many('hr.evaluation.interview', 'user_to_review_id', 'Appraisal Interviews'),
+ 'appraisal_count': fields.function(_appraisal_count, type='integer', string='Appraisal Interviews'),
}
+
def run_employee_evaluation(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
now = parser.parse(datetime.now().strftime('%Y-%m-%d'))
obj_evaluation = self.pool.get('hr_evaluation.evaluation')
class="oe_stat_button"
icon="fa-sitemap"
type="action">
- <field name="appraisal_count" widget="statinfo" string="Form"/>
+ <field name="appraisal_count" widget="statinfo" string="Appraisals"/>
</button>
</xpath>
</field>
result[holiday.employee_id.id]['current_leave_id'] = holiday.holiday_status_id.id
return result
+ def _leaves_count(self, cr, uid, ids, field_name, arg, context=None):
+ res = dict(map(lambda x: (x,0), ids))
+ try:
+ for employee in self.browse(cr, uid, ids, context=context):
+ res[employee.id] = len(employee.leave_ids)
+ except:
+ pass
+ return res
+
_columns = {
'remaining_leaves': fields.function(_get_remaining_days, string='Remaining Legal Leaves', fnct_inv=_set_remaining_days, type="float", help='Total number of legal leaves allocated to this employee, change this value to create allocation/leave request. Total based on all the leave types without overriding limit.'),
'current_leave_state': fields.function(_get_leave_status, multi="leave_status", string="Current Leave Status", type="selection",
'current_leave_id': fields.function(_get_leave_status, multi="leave_status", string="Current Leave Type",type='many2one', relation='hr.holidays.status'),
'leave_date_from': fields.function(_get_leave_status, multi='leave_status', type='date', string='From Date'),
'leave_date_to': fields.function(_get_leave_status, multi='leave_status', type='date', string='To Date'),
+ 'leave_ids': fields.one2many('hr.holidays', 'employee_id', 'Leaves'),
+ 'leaves_count': fields.function(_leaves_count, type='integer', string='Leaves'),
+
}
res[employee.id] = {'basic': result['sum']}
return res
+ def _payslip_count(self, cr, uid, ids, field_name, arg, context=None):
+ res = dict(map(lambda x: (x,0), ids))
+ try:
+ for employee in self.browse(cr, uid, ids, context=context):
+ res[employee.id] = len(employee.payslip_ids)
+ except:
+ pass
+ return res
+
_columns = {
'slip_ids':fields.one2many('hr.payslip', 'employee_id', 'Payslips', required=False, readonly=True),
'total_wage': fields.function(_calculate_total_wage, method=True, type='float', string='Total Basic Salary', digits_compute=dp.get_precision('Payroll'), help="Sum of all current contract's wage of employee."),
+ 'payslip_count': fields.function(_payslip_count, type='integer', string='Payslips'),
+ 'payslip_ids': fields.one2many('hr.payslip', 'employee_id', 'Payslips'),
}
], context=context)
return res
+ def _count_all(self, cr, uid, ids, field_name, arg, context=None):
+ res = dict(map(lambda x: (x,{'documents_count': 0, 'application_count': 0,}), ids))
+ try:
+ for job in self.browse(cr, uid, ids, context=context):
+ res[job.id] = {'documents_count': len(job.document_ids),
+ 'application_count': len(job.applicant_ids),
+ }
+ except:
+ pass
+ return res
+
_columns = {
'survey_id': fields.many2one('survey', 'Interview Form', help="Choose an interview form for this job position and you will be able to print/answer this interview from all applicants who apply for this job"),
'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True,
"create new applicants for this job position."),
'address_id': fields.many2one('res.partner', 'Job Location', help="Address where employees are working"),
'application_ids': fields.one2many('hr.applicant', 'job_id', 'Applications'),
+ 'application_count': fields.function(_count_all, type='integer', string='Applications', multi=True),
'manager_id': fields.related('department_id', 'manager_id', type='many2one', string='Department Manager', relation='hr.employee', readonly=True, store=True),
'document_ids': fields.function(_get_attached_docs, type='one2many', relation='ir.attachment', string='Applications'),
+ 'documents_count': fields.function(_count_all, type='integer', string='Documents', multi=True),
'user_id': fields.many2one('res.users', 'Recruitment Responsible', track_visibility='onchange'),
'color': fields.integer('Color Index'),
}
<sheet>
<div class="oe_right oe_button_box">
<button name="action_makeMeeting" class="oe_stat_button" icon="fa-calendar" type="object"
- string="Meeting" help="Schedule interview with this applicant"/>
+ help="Schedule interview with this applicant">
+ <div>Schedule<br/>Meeting</div>
+ </button>
<button name="%(survey.action_view_survey_question_message)d"
class="oe_stat_button"
icon="fa-user"
type="action"
- string="Interview" help="Answer related job question"
+ help="Answer related job question"
context="{'survey_id': survey, 'response_id': [response], 'response_no':0 ,'active' : response, 'object' : 'hr.applicant'}"
- attrs="{'invisible':[('survey','=',False)]}"/>
+ attrs="{'invisible':[('survey','=',False)]}">
+ <div>Start<br/>Interview</div>
+ </button>
<button name="action_print_survey"
class="oe_stat_button"
icon="fa-print"
type="object"
- string="Print" help="Print interview report"
- attrs="{'invisible':[('survey','=',False)]}"/>
+ help="Print interview report"
+ attrs="{'invisible':[('survey','=',False)]}">
+ <div>Print<br/>Interview</div>
+ </button>
<button name="action_get_attachment_tree_view"
class="oe_stat_button"
icon="fa-book"
'timesheet_max_difference': lambda *args: 0.0
}
+class hr_employee(osv.osv):
+ '''
+ Employee
+ '''
+ _inherit = 'hr.employee'
+ _description = 'Employee'
+
+ def _timesheet_count(self, cr, uid, ids, field_name, arg, context=None):
+ res = dict(map(lambda x: (x,0), ids))
+ try:
+ for employee in self.browse(cr, uid, ids, context=context):
+ res[employee.id] = len(employee.timesheet_ids)
+ except:
+ pass
+ return res
+
+ _columns = {
+ 'timesheet_ids': fields.one2many('hr_timesheet_sheet.sheet', 'employee_id', 'Timesheets'),
+ 'timesheet_count': fields.function(_timesheet_count, type='integer', string='Timsheets'),
+ }
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: