From e5fb623048d4a1c7710bbd8f3f684366031c320d Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Thu, 31 Mar 2011 17:58:29 +0530 Subject: [PATCH] [IMP] raise warning if there isn't any contract selected on employee leave request bzr revid: psi@tinyerp.co.in-20110331122829-20k622n739xad2xi --- addons/hr_payroll/hr_payroll.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index 06a30af5e38..b14edbf1b6a 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -811,7 +811,7 @@ class hr_payslip(osv.osv): value = line.amount else: value = line.amount - + elif line.amount_type == 'code': localdict = {'basic': amt, 'employee': slip.employee_id, 'contract': contract} exec line.python_compute in localdict @@ -828,7 +828,7 @@ class hr_payslip(osv.osv): value = val else: value = val - + total += value vals = { 'slip_id': slip.id, @@ -1349,6 +1349,13 @@ class hr_holidays(osv.osv): }) return {'value': res} + def holidays_confirm(self, cr, uid, ids, *args): + leaves = self.browse(cr, uid, ids) + for leave in leaves: + if not leave.contract_id: + raise osv.except_osv(_('Warning !'), _("Please define contract on %s's leave request ! ") % (leave.employee_id.name)) + return super(hr_holidays, self).holidays_confirm(cr, uid, ids) + hr_holidays() class hr_payslip_line(osv.osv):