diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 419b1bb8335..d149493f18f 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -412,7 +412,7 @@ class hr_holidays(osv.osv): def create_notificate(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context=context): - self.message_post(cr, uid, ids, + self.message_post(cr, uid, [obj.id], _("Request created, waiting confirmation."), context=context) return True diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 6a4cfd39c69..de0ccd3893c 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -95,6 +95,7 @@ class hr_timesheet_sheet(osv.osv): if (abs(sheet.total_difference) < di) or not di: wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'hr_timesheet_sheet.sheet', sheet.id, 'confirm', cr) + self.confirm_send_note(cr, uid, ids, context) else: raise osv.except_osv(_('Warning!'), _('Please verify that the total difference of the sheet is lower than %.2f.') %(di,)) return True @@ -222,6 +223,20 @@ class hr_timesheet_sheet(osv.osv): department_id = self.pool.get('hr.employee').browse(cr, uid, employee_id, context=context).department_id.id return {'value': {'department_id': department_id}} + # ------------------------------------------------ + # OpenChatter methods and notifications + # ------------------------------------------------ + + def needaction_domain_get(self, cr, uid, ids, context=None): + emp_obj = self.pool.get('hr.employee') + empids = emp_obj.search(cr, uid, [('parent_id.user_id', '=', uid)], context=context) + dom = ['&', ('state', '=', 'confirm'), ('employee_id', 'in', empids)] + return dom + + def confirm_send_note(self, cr, uid, ids, context=None): + for obj in self.browse(cr, uid, ids, context=context): + self.message_post(cr, uid, [obj.id], body=_("Timesheet has been submitted by %s.") % (obj.employee_id.name), context=context) + hr_timesheet_sheet() class account_analytic_line(osv.osv):