From 7f1e1c72468b41c80823a27077b9ac21374e4084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 5 Aug 2013 13:30:23 +0200 Subject: [PATCH] [IMP] hr_holidays: workflow update starts in confirm from confirm, possible to get back to draft with reset signal, calling old set_to_draft, now renamed holidays_reset, in the same workflow from draft, possible to go to confirm bzr revid: tde@openerp.com-20130805113023-1cs1s18dd5m4mi20 --- addons/hr_holidays/hr_holidays.py | 8 +++---- addons/hr_holidays/hr_holidays_data.xml | 2 +- addons/hr_holidays/hr_holidays_view.xml | 7 +++--- addons/hr_holidays/hr_holidays_workflow.xml | 25 +++++++++++++++------ addons/hr_holidays/test/test_hr_holiday.yml | 2 +- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 6dc58bbdb24..b75d2538e4e 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -165,7 +165,7 @@ class hr_holidays(osv.osv): } _defaults = { 'employee_id': _employee_get, - 'state': 'draft', + 'state': 'confirm', 'type': 'remove', 'user_id': lambda obj, cr, uid, context: uid, 'holiday_type': 'employee' @@ -306,18 +306,16 @@ class hr_holidays(osv.osv): raise osv.except_osv(_('Warning!'),_('You cannot modify a leave request that has been approved. Contact a human resource manager.')) return super(hr_holidays, self).write(cr, uid, ids, vals, context=context) - def set_to_draft(self, cr, uid, ids, context=None): + def holidays_reset(self, cr, uid, ids, context=None): self.write(cr, uid, ids, { 'state': 'draft', 'manager_id': False, 'manager_id2': False, }) - self.delete_workflow(cr, uid, ids) - self.create_workflow(cr, uid, ids) to_unlink = [] for record in self.browse(cr, uid, ids, context=context): for record2 in record.linked_request_ids: - self.set_to_draft(cr, uid, [record2.id], context=context) + self.holidays_reset(cr, uid, [record2.id], context=context) to_unlink.append(record2.id) if to_unlink: self.unlink(cr, uid, to_unlink, context=context) diff --git a/addons/hr_holidays/hr_holidays_data.xml b/addons/hr_holidays/hr_holidays_data.xml index 2b370f08821..703fa74a2ee 100644 --- a/addons/hr_holidays/hr_holidays_data.xml +++ b/addons/hr_holidays/hr_holidays_data.xml @@ -49,7 +49,7 @@ To Approve hr.holidays - Request created and waiting confirmation + Request confirmed and waiting approval Approved diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index 85bbcb96f94..9a91a2198ef 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -54,10 +54,11 @@
+
@@ -102,7 +103,7 @@