[FIX] hr_payroll_account: deletion of a payslip with account_move

lp bug: https://launchpad.net/bugs/862218 fixed

bzr revid: qdp-launchpad@openerp.com-20111007134926-ur815yiv5gdq02pg
This commit is contained in:
Quentin (OpenERP) 2011-10-07 15:49:26 +02:00
parent 93e8d85aa1
commit 343937cd3c
1 changed files with 4 additions and 3 deletions

View File

@ -59,9 +59,10 @@ class hr_payslip(osv.osv):
move_ids = []
move_to_cancel = []
for slip in self.browse(cr, uid, ids, context=context):
move_ids.append(slip.move_id.id)
if slip.move_id.state == 'posted':
move_to_cancel.append(slip.move_id.id)
if slip.move_id:
move_ids.append(slip.move_id.id)
if slip.move_id.state == 'posted':
move_to_cancel.append(slip.move_id.id)
move_pool.button_cancel(cr, uid, move_to_cancel, context=context)
move_pool.unlink(cr, uid, move_ids, context=context)
return super(hr_payslip, self).cancel_sheet(cr, uid, ids, context=context)