From 40745949d4378253601a6e5536f7578028a9267a Mon Sep 17 00:00:00 2001 From: Hardik Date: Fri, 9 Nov 2012 19:07:05 +0530 Subject: [PATCH 1/2] [IMP]following fields are invalid user in timesheet bzr revid: hsa@tinyerp.com-20121109133705-biefd0u3d50zyzh6 --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 3 +-- addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index bf6790c6be3..cb3a1b23aed 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -97,7 +97,7 @@ class hr_timesheet_sheet(osv.osv): wf_service.trg_validate(uid, 'hr_timesheet_sheet.sheet', sheet.id, 'confirm', cr) else: raise osv.except_osv(_('Warning!'), _('Please verify that the total difference of the sheet is lower than %.2f.') %(di,)) - return True + return True def attendance_action_change(self, cr, uid, ids, context=None): hr_employee = self.pool.get('hr.employee') @@ -220,7 +220,6 @@ class hr_timesheet_sheet(osv.osv): if employee_id: department_id = self.pool.get('hr.employee').browse(cr, uid, employee_id, context=context).department_id.id return {'value': {'department_id': department_id}} - hr_timesheet_sheet() class account_analytic_line(osv.osv): diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index ee5a329c800..a464ffb0b49 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -115,7 +115,7 @@ - +
From d987291a6361a8624e266db8e7d074484aaeb936 Mon Sep 17 00:00:00 2001 From: "Pinakin Nayi (OpenERP)" Date: Mon, 12 Nov 2012 15:24:24 +0530 Subject: [PATCH 2/2] [IMP]hr_timesheet_shhet add chatter bzr revid: pna@tinyerp.com-20121112095424-p3z0bwx1f38nbv4n --- addons/hr_holidays/hr_holidays.py | 2 +- .../hr_timesheet_sheet/hr_timesheet_sheet.py | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) 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 cb3a1b23aed..aa594c8a13c 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -95,9 +95,10 @@ 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 + return True def attendance_action_change(self, cr, uid, ids, context=None): hr_employee = self.pool.get('hr.employee') @@ -220,6 +221,21 @@ class hr_timesheet_sheet(osv.osv): if employee_id: 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):