[FIX] HR_Timesheet_sheet : timesheet cannot be deleted which have attendance entries encoded
lp bug: https://launchpad.net/bugs/496991 fixed bzr revid: jvo@tinyerp.com-20091221130004-75pxba8k30an2qpj
This commit is contained in:
parent
be00e4bc94
commit
f5a36da0c1
|
@ -300,9 +300,12 @@ class hr_timesheet_sheet(osv.osv):
|
|||
context, load='_classic_write')]
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
sheets = self.read(cr, uid, ids, ['state'])
|
||||
if any(s['state'] in ('confirm', 'done') for s in sheets):
|
||||
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Sheet(s) which are already confirmed !'))
|
||||
sheets = self.read(cr, uid, ids, ['state','total_attendance'])
|
||||
for sheet in sheets:
|
||||
if sheet['state'] in ('confirm', 'done'):
|
||||
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Sheet(s) which are already confirmed !'))
|
||||
elif sheet['total_attendance'] <> 0.00:
|
||||
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Sheet(s) which have attendance entries encoded !'))
|
||||
return super(hr_timesheet_sheet, self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
hr_timesheet_sheet()
|
||||
|
|
Loading…
Reference in New Issue