HR_TIMESHEET_SHEET: add 'Set to Draft' button

bzr revid: ced-747d8d50c2a56831777bf70b8a260d6b94df099b
This commit is contained in:
ced 2007-06-18 10:20:48 +00:00
parent 70734616d8
commit e39807ae86
3 changed files with 9 additions and 7 deletions

View File

@ -252,6 +252,14 @@ class hr_timesheet_sheet(osv.osv):
_constraints = [
(_sheet_date, 'You can not have 2 timesheets that overlaps !', ['date_from','date_to'])
]
def action_set_to_draft(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {'state': 'draft'})
wf_service = netsvc.LocalService('workflow')
for id in ids:
wf_service.trg_create(uid, self._name, id, cr)
return True
hr_timesheet_sheet()
def _get_current_sheet(self, cr, uid, context={}):

View File

@ -118,7 +118,7 @@
<field name="state"/>
<group col="4" colspan="2">
<button string="Confirm" name="button_confirm" states="draft" type="object"/>
<button string="Cancel" name="cancel" states="done"/>
<button string="Set to Draft" name="action_set_to_draft" states="done" type="object"/>
<button string="Refuse" name="cancel" states="confirm"/>
<button string="Accept" name="done" states="confirm"/>
</group>

View File

@ -64,11 +64,5 @@
<field name="signal">cancel</field>
<field name="role_id" ref="HR"/>
</record>
<record model="workflow.transition" id="t4">
<field name="act_from" ref="act_done" />
<field name="act_to" ref="act_draft" />
<field name="signal">cancel</field>
<field name="role_id" ref="HR"/>
</record>
</data>
</terp>