diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index aa2b6b9bda6..7b538d53d85 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -389,58 +389,6 @@ class hr_applicant(crm.crm_case, osv.osv): self.message_append_dict(cr, uid, ids, msg, context=context) return res - def case_get_note_msg_prefix(self, cr, uid, id, context=None): - return 'Applicant' - - def case_open_send_note(self, cr, uid, ids, context=None): - message = _("Applicant has been set in progress.") - return self.message_append_note(cr, uid, ids, _('System notification'), - message, type='notification', context=context) - - def case_close_send_note(self, cr, uid, ids, context=None): - if context is None: - context = {} - for applicant in self.browse(cr, uid, ids, context=context): - if applicant.emp_id: - message = _("Applicant has been hired and created as an employee.") - self.message_append_note(cr, uid, [applicant.id], _('System notification'), - message, type='notification', context=context) - else: - message = _("Applicant has been hired.") - self.message_append_note(cr, uid, [applicant.id], _('System notification'), - message, type='notification', context=context) - return True - - def case_cancel_send_note(self, cr, uid, ids, context=None): - for id in ids: - msg = 'Applicant refused.' - self.message_append_note(cr, uid, [id], 'System Notification', msg, context=context) - return True - - def case_reset_send_note(self, cr, uid, ids, context=None): - message =_("Applicant has been set as new.") - return self.message_append_note(cr, uid, ids, _('System notification'), - message, type='notification', context=context) - - def message_get_subscribers(self, cr, uid, ids, context=None): - sub_ids = self.message_get_subscribers_ids(cr, uid, ids, context=context); - for obj in self.browse(cr, uid, ids, context=context): - if obj.user_id: - sub_ids.append(obj.user_id.id) - return self.pool.get('res.users').read(cr, uid, sub_ids, context=context) - - def get_needaction_user_ids(self, cr, uid, ids, context=None): - result = dict.fromkeys(ids, []) - for obj in self.browse(cr, uid, ids, context=context): - if obj.state == 'draft' and obj.user_id: - result[obj.id] = [obj.user_id.id] - return result - - def create_send_note(self, cr, uid, ids, context=None): - message = _("Applicant has been created.") - return self.message_append_note(cr, uid, ids, _('System notification'), - message, type='notification', context=context) - def create(self, cr, uid, vals, context=None): obj_id = super(hr_applicant, self).create(cr, uid, vals, context=context) self.create_send_note(cr, uid, [obj_id], context=context) @@ -528,10 +476,58 @@ 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') + self.message_append_note(cr, uid, ids, _body=_("Stage changed to %s.") % stage.name, context=context) return super(hr_applicant,self).write(cr, uid, ids, vals, context=context) + # ------------------------------------------------------- + # OpenChatter methods and notifications + # ------------------------------------------------------- + + def message_get_subscribers(self, cr, uid, ids, context=None): + sub_ids = self.message_get_subscribers_ids(cr, uid, ids, context=context); + for obj in self.browse(cr, uid, ids, context=context): + if obj.user_id: + sub_ids.append(obj.user_id.id) + return self.pool.get('res.users').read(cr, uid, sub_ids, context=context) + + def get_needaction_user_ids(self, cr, uid, ids, context=None): + result = dict.fromkeys(ids, []) + for obj in self.browse(cr, uid, ids, context=context): + if obj.state == 'draft' and obj.user_id: + result[obj.id] = [obj.user_id.id] + return result + + def case_get_note_msg_prefix(self, cr, uid, id, context=None): + return 'Applicant' + + def case_open_send_note(self, cr, uid, ids, context=None): + message = _("Applicant has been set in progress.") + return self.message_append_note(cr, uid, ids, body=message, context=context) + + def case_close_send_note(self, cr, uid, ids, context=None): + if context is None: + context = {} + for applicant in self.browse(cr, uid, ids, context=context): + if applicant.emp_id: + message = _("Applicant has been hired and created as an employee.") + self.message_append_note(cr, uid, [applicant.id], body=message, context=context) + else: + message = _("Applicant has been hired.") + self.message_append_note(cr, uid, [applicant.id], body=message, context=context) + return True + + def case_cancel_send_note(self, cr, uid, ids, context=None): + msg = 'Applicant refused.' + return self.message_append_note(cr, uid, ids, body=msg, context=context) + + def case_reset_send_note(self, cr, uid, ids, context=None): + message =_("Applicant has been set as new.") + return self.message_append_note(cr, uid, ids, body=message, context=context) + + def create_send_note(self, cr, uid, ids, context=None): + message = _("Applicant has been created.") + return self.message_append_note(cr, uid, ids, body=message, context=context) + hr_applicant() class hr_job(osv.osv):