diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index ccb8af68e21..3327312ef9d 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -127,6 +127,7 @@ class hr_expense_expense(osv.osv): for expense in self.browse(cr, uid, ids): if expense.employee_id and expense.employee_id.parent_id.user_id: self.message_subscribe_users(cr, uid, [expense.id], user_ids=[expense.employee_id.parent_id.user_id.id]) + self.expense_toapprove_notificate(cr, uid, ids) self.write(cr, uid, ids, { 'state':'confirm', 'date_confirm': time.strftime('%Y-%m-%d') @@ -134,6 +135,7 @@ class hr_expense_expense(osv.osv): return True def expense_accept(self, cr, uid, ids, *args): + self.expense_approve_notificate(cr, uid, ids) self.write(cr, uid, ids, { 'state':'accepted', 'date_valid':time.strftime('%Y-%m-%d'), @@ -142,6 +144,7 @@ class hr_expense_expense(osv.osv): return True def expense_canceled(self, cr, uid, ids, *args): + self.expense_refuse_notificate(cr, uid, ids) self.write(cr, uid, ids, {'state':'cancelled'}) return True @@ -234,6 +237,21 @@ class hr_expense_expense(osv.osv): } return result + def expense_toapprove_notificate(self, cr, uid, ids, context=None): + for obj in self.browse(cr, uid, ids): + self.message_post(cr, uid, [obj.id], + _("The request is waiting for Approval"), subtype="hr_expense.mt_expense_approve", context=context) + + def expense_approve_notificate(self, cr, uid, ids, context=None): + for obj in self.browse(cr, uid, ids): + self.message_post(cr, uid, [obj.id], + _("The request has been approved"), subtype="hr_expense.mt_expense_approved", context=context) + + def expense_refuse_notificate(self, cr, uid, ids, context=None): + for obj in self.browse(cr, uid, ids): + self.message_post(cr, uid, [obj.id], + _("Request refused"), subtype="hr_expense.mt_expense_refused", context=context) + hr_expense_expense() class product_product(osv.osv): diff --git a/addons/hr_expense/hr_expense_data.xml b/addons/hr_expense/hr_expense_data.xml index f54156ac5ec..01b839582e3 100644 --- a/addons/hr_expense/hr_expense_data.xml +++ b/addons/hr_expense/hr_expense_data.xml @@ -17,5 +17,24 @@ Expenses + + + + To Approve + hr.expense.expense + + + + + Approved + hr.expense.expense + + + + + Refused + hr.expense.expense + + diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 92b1d57ce15..ebba92f814c 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -431,7 +431,7 @@ class hr_holidays(osv.osv): def holidays_confirm_notificate(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids): self.message_post(cr, uid, [obj.id], - _("Request submitted, waiting for validation by the manager."), context=context) + _("Request submitted, waiting for validation by the manager."), subtype="hr_holidays.mt_approve", context=context) def holidays_first_validate_notificate(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context=context): @@ -445,12 +445,12 @@ class hr_holidays(osv.osv): _("Request validated."), context=context) else: self.message_post(cr, uid, [obj.id], - _("The request has been approved."), context=context) + _("The request has been approved."), subtype="hr_holidays.mt_approved", context=context) def holidays_refuse_notificate(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids): self.message_post(cr, uid, [obj.id], - _("Request refused"), context=context) + _("Request refused"), subtype="hr_holidays.mt_refused", context=context) class resource_calendar_leaves(osv.osv): diff --git a/addons/hr_holidays/hr_holidays_data.xml b/addons/hr_holidays/hr_holidays_data.xml index 5af0c60fc44..ad15f170e56 100644 --- a/addons/hr_holidays/hr_holidays_data.xml +++ b/addons/hr_holidays/hr_holidays_data.xml @@ -44,5 +44,25 @@ True brown + + + + To Approve + hr.holidays + + + + + Approved + hr.holidays + + + + + Refused + hr.holidays + + + diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index de1539da55a..19ff56b35a6 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -469,12 +469,6 @@ class hr_applicant(base_stage, osv.Model): # OpenChatter methods and notifications # ------------------------------------------------------- - def stage_set_send_note(self, cr, uid, ids, stage_id, context=None): - """ Override of the (void) default notification method. """ - if not stage_id: return True - stage_name = self.pool.get('hr.recruitment.stage').name_get(cr, uid, [stage_id], context=context)[0][1] - return self.message_post(cr, uid, ids, body=_("Stage changed to %s.") % (stage_name), context=context) - def case_get_note_msg_prefix(self, cr, uid, id, context=None): return 'Applicant' @@ -487,18 +481,18 @@ class hr_applicant(base_stage, osv.Model): context = {} for applicant in self.browse(cr, uid, ids, context=context): if applicant.job_id: - self.pool.get('hr.job').message_post(cr, uid, [applicant.job_id.id], body=_('New employee joined the company %s.')%(applicant.name,), subtype="hr_recruitment.mt_hired", context=context) + self.pool.get('hr.job').message_post(cr, uid, [applicant.job_id.id], body=_('New employee joined the company %s.')%(applicant.name,), context=context) if applicant.emp_id: message = _("Applicant has been hired and created as an employee.") self.message_post(cr, uid, [applicant.id], body=message, context=context) else: message = _("Applicant has been hired.") - self.message_post(cr, uid, [applicant.id], body=message, context=context) + self.message_post(cr, uid, [applicant.id], body=message, subtype="hr_recruitment.mt_applicant_hired", context=context) return True def case_cancel_send_note(self, cr, uid, ids, context=None): msg = 'Applicant refused.' - return self.message_post(cr, uid, ids, body=msg, context=context) + return self.message_post(cr, uid, ids, body=msg, subtype="hr_recruitment.mt_applicant_refused",context=context) def case_reset_send_note(self, cr, uid, ids, context=None): message =_("Applicant has been set as new.") diff --git a/addons/hr_recruitment/hr_recruitment_data.xml b/addons/hr_recruitment/hr_recruitment_data.xml index adaeed81205..42872a3d2a7 100644 --- a/addons/hr_recruitment/hr_recruitment_data.xml +++ b/addons/hr_recruitment/hr_recruitment_data.xml @@ -462,13 +462,39 @@ - - Employee Hired - hr.job - New Applicant hr.job + + Stage changed + hr.job + + + + Applicant Hired + hr.job + + + + Refused + hr.job + + + + Stage changed + hr.applicant + + + + Applicant Hired + hr.applicant + + + + Applicant Refused + hr.applicant + +