[MERGE] do not delete confirmed payslip

bzr revid: fp@tinyerp.com-20121113075733-kidt1mqc9tf8xayh
This commit is contained in:
Fabien Pinckaers 2012-11-13 08:57:33 +01:00
commit 8fe74c7900
1 changed files with 6 additions and 0 deletions

View File

@ -359,6 +359,12 @@ class hr_payslip(osv.osv):
def check_done(self, cr, uid, ids, context=None):
return True
def unlink(self, cr, uid, ids, context=None):
for payslip in self.browse(cr, uid, ids, context=context):
if payslip.state not in ['draft','cancel']:
raise osv.except_osv(_('Warning!'),_('You cannot delete a payslip which is not draft or cancelled!'))
return super(hr_payslip, self).unlink(cr, uid, ids, context)
#TODO move this function into hr_contract module, on hr.employee object
def get_contract(self, cr, uid, employee, date_from, date_to, context=None):
"""