An employee should receive a mail.message in inbox when an manager refuse a timesheet.
bzr revid: tta@openerp.com-20121122110015-61xx09vchksen6v3
This commit is contained in:
parent
0c07c9c827
commit
cd4899aa6a
|
@ -100,6 +100,15 @@ class hr_timesheet_sheet(osv.osv):
|
|||
raise osv.except_osv(_('Warning!'), _('Please verify that the total difference of the sheet is lower than %.2f.') %(di,))
|
||||
return True
|
||||
|
||||
def button_cancel(self, cr, uid, ids, context=None):
|
||||
for sheet in self.browse(cr, uid, ids, context=context):
|
||||
if sheet.employee_id and sheet.employee_id.user_id:
|
||||
self.message_subscribe_users(cr, uid, [sheet.id], user_ids=[sheet.employee_id.user_id.id], context=context)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'hr_timesheet_sheet.sheet', sheet.id, 'cancel', cr)
|
||||
self.cancel_send_note(cr, uid, ids, context=context)
|
||||
return True
|
||||
|
||||
def attendance_action_change(self, cr, uid, ids, context=None):
|
||||
hr_employee = self.pool.get('hr.employee')
|
||||
employee_ids = []
|
||||
|
@ -237,6 +246,11 @@ class hr_timesheet_sheet(osv.osv):
|
|||
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), subtype="hr_timesheet_sheet.mt_submit_timesheet", context=context)
|
||||
|
||||
def cancel_send_note(self, cr, uid, ids, context=None):
|
||||
user_name = self.pool.get("res.users").browse(cr, uid, uid, context=context).name
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
self.message_post(cr, uid, [obj.id], body=_("Timesheet has been refused by %s.") % (user_name), subtype="hr_timesheet_sheet.mt_refuse_timesheet", context=context)
|
||||
|
||||
hr_timesheet_sheet()
|
||||
|
||||
class account_analytic_line(osv.osv):
|
||||
|
|
|
@ -24,7 +24,12 @@
|
|||
<menuitem name="My Current Timesheet" id="menu_act_hr_timesheet_sheet_form_my_current" parent="hr_attendance.menu_hr_time_tracking" action="ir_actions_server_timsheet_sheet" sequence="1"/>
|
||||
|
||||
<record id="mt_submit_timesheet" model="mail.message.subtype">
|
||||
<field name="name">Timesheets to Validate</field>
|
||||
<field name="name">Submit</field>
|
||||
<field name="res_model">hr_timesheet_sheet.sheet</field>
|
||||
</record>
|
||||
|
||||
<record id="mt_refuse_timesheet" model="mail.message.subtype">
|
||||
<field name="name">Refuse</field>
|
||||
<field name="res_model">hr_timesheet_sheet.sheet</field>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<button name="button_confirm" states="draft" string="Submit to Manager" type="object" class="oe_highlight"/>
|
||||
<button name="done" states="confirm" string="Approve" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
|
||||
<button name="action_set_to_draft" states="done" string="Set to Draft" type="object" />
|
||||
<button name="cancel" states="confirm" string="Refuse" type="workflow" groups="base.group_hr_user" />
|
||||
<button name="button_cancel" states="confirm" string="Refuse" type="object" groups="base.group_hr_user" />
|
||||
<field name="state" widget="statusbar" statusbar_visible="new,confirm,done"/>
|
||||
</header>
|
||||
<sheet>
|
||||
|
|
Loading…
Reference in New Issue