From: Thibault Delavallée Date: Tue, 20 Mar 2012 17:20:58 +0000 (+0100) Subject: [REM] hr_recruitment: back to social-trunk-tde version, because already developed... X-Git-Tag: 7.0-server~3709^2~58^2~5 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=2e48fb0413b54b6b09dba06e4385b2d3a95f4505;p=odoo%2Fodoo.git [REM] hr_recruitment: back to social-trunk-tde version, because already developed in another merge proposal bzr revid: tde@openerp.com-20120320172058-is9xef2flxm6b68l --- diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 18d3f85..68855b7 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -171,6 +171,7 @@ class hr_applicant(crm.crm_case, osv.osv): 'partner_mobile': fields.char('Mobile', size=32), 'type_id': fields.many2one('hr.recruitment.degree', 'Degree'), 'department_id': fields.many2one('hr.department', 'Department'), + 'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True), 'survey': fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'), 'response': fields.integer("Response"), 'reference': fields.char('Refered By', size=128), @@ -180,7 +181,6 @@ class hr_applicant(crm.crm_case, osv.osv): 'day_close': fields.function(_compute_day, string='Days to Close', \ multi='day_close', type="float", store=True), 'color': fields.integer('Color Index'), - 'emp_id': fields.many2one('hr.employee', 'employee'), 'user_email': fields.related('user_id', 'user_email', type='char', string='User Email', readonly=True), } @@ -391,65 +391,31 @@ class hr_applicant(crm.crm_case, osv.osv): self.message_append_dict(cr, uid, ids, msg, context=context) return res - def _case_open_notification(self, case, context=None): - message = _("Changed Status to in Progress.") - case.message_append_note('' ,message, type='notification') - return True - - def _case_close_notification(self, case, context=None): - case[0].message_mark_done(context) - if case[0].emp_id: - message = _("Applicant is hired and employee created.") - case[0].message_append_note('' ,message, type='notification') - else: - message = _("Applicant is hired.") - case[0].message_append_note('' ,message, type='notification') - return True - - def _case_cancel_notification(self, case, context=None): - case[0].message_mark_done(context=context) - message = _("Applicant is cancelled.") - case[0].message_append_note('' ,message, type="notification") - return True - - def _case_pending_notification(self, case, context=None): - message = _("Changed Status to pending.") - case[0].message_append_note('' ,message, type='notification') - return True - - def _case_reset_notification(self, cr, uid, ids, context=None): - for obj in self.browse(cr, uid, ids, context=context): - self.message_append_note(cr, uid, ids, _('System notification'), - _("Changed Status to new."), type='notification', need_action_user_id=obj.user_id.id, context=context) - return True - - def create_notificate(self, cr, uid, ids, context=None): - for obj in self.browse(cr, uid, ids, context=context): - self.message_subscribe(cr, uid, ids, [obj.user_id.id], context=context) - self.message_append_note(cr, uid, ids, _('System notification'), - _("Applicant is created."), type='notification', need_action_user_id=obj.user_id.id, context=context) - return True - - def create(self, cr, uid, vals, context=None): - obj_id = super(hr_applicant, self).create(cr, uid, vals, context=context) - self.create_notificate(cr, uid, [obj_id], context=context) - return obj_id - - def case_open(self, cr, uid, ids, context=None): + def case_open(self, cr, uid, ids, *args): """ - open Request of the applicant for the hr_recruitment + @param self: The object pointer + @param cr: the current row, from the database cursor, + @param uid: the current user’s ID for security checks, + @param ids: List of case's Ids + @param *args: Give Tuple Value """ - res = super(hr_applicant, self).case_open(cr, uid, ids, context) + res = super(hr_applicant, self).case_open(cr, uid, ids, *args) date = self.read(cr, uid, ids, ['date_open'])[0] if not date['date_open']: self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S'),}) + for (id, name) in self.name_get(cr, uid, ids): + message = _("The job request '%s' has been set 'in progress'.") % name + self.log(cr, uid, id, message) return res - def case_close(self, cr, uid, ids, context=None): - res = super(hr_applicant, self).case_close(cr, uid, ids, context) + def case_close(self, cr, uid, ids, *args): + res = super(hr_applicant, self).case_close(cr, uid, ids, *args) + for (id, name) in self.name_get(cr, uid, ids): + message = _("Applicant '%s' is being hired.") % name + self.log(cr, uid, id, message) return res - def case_close_with_emp(self, cr, uid, ids, context=None): + def case_close_with_emp(self, cr, uid, ids, *args): hr_employee = self.pool.get('hr.employee') model_data = self.pool.get('ir.model.data') act_window = self.pool.get('ir.actions.act_window') @@ -465,8 +431,7 @@ class hr_applicant(crm.crm_case, osv.osv): 'address_home_id': address_id, 'department_id': applicant.department_id.id }) - self.write(cr, uid, [applicant.id], {'emp_id': emp_id}) - self.case_close(cr, uid, [applicant.id], context) + self.case_close(cr, uid, [applicant.id], *args) else: raise osv.except_osv(_('Warning!'),_('You must define Applied Job for this applicant.')) @@ -477,25 +442,17 @@ class hr_applicant(crm.crm_case, osv.osv): dict_act_window['view_mode'] = 'form,tree' return dict_act_window - def case_cancel(self, cr, uid, ids, context=None): - """Overrides cancel for crm_case for setting probability - """ - res = super(hr_applicant, self).case_cancel(cr, uid, ids, context) - self.write(cr, uid, ids, {'probability' : 0.0}) - return res - - def case_pending(self, cr, uid, ids, context=None): - """Marks case as pending""" - res = super(hr_applicant, self).case_pending(cr, uid, ids, context) - self.write(cr, uid, ids, {'probability' : 0.0}) - return res - - def case_reset(self, cr, uid, ids, context=None): + def case_reset(self, cr, uid, ids, *args): """Resets case as draft + @param self: The object pointer + @param cr: the current row, from the database cursor, + @param uid: the current user’s ID for security checks, + @param ids: List of case Ids + @param *args: Tuple Value for additional Params """ - res = super(hr_applicant, self).case_reset(cr, uid, ids, context) + + res = super(hr_applicant, self).case_reset(cr, uid, ids, *args) self.write(cr, uid, ids, {'date_open': False, 'date_closed': False}) - self._case_reset_notification(cr, uid, ids, context) return res def set_priority(self, cr, uid, ids, priority, *args): @@ -516,8 +473,8 @@ class hr_applicant(crm.crm_case, osv.osv): def write(self, cr, uid, ids, vals, context=None): if 'stage_id' in vals and vals['stage_id']: stage = self.pool.get('hr.recruitment.stage').browse(cr, uid, vals['stage_id'], context=context) - self.message_append_note(cr, uid, ids, _('System notification'), - _("Changed stage to %s.") % stage.name, type='notification') + text = _("Changed Stage to: %s") % stage.name + self.message_append(cr, uid, ids, text, body_text=text, context=context) return super(hr_applicant,self).write(cr, uid, ids, vals, context=context) hr_applicant() diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index 2faac78..69a7c10 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -79,9 +79,6 @@