Nehal Panchal (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/6.1-opw-584846-nep into lp:openobject-addons/6.1.
Requested reviews: Naresh(OpenERP) (nch-openerp) For more details, see: https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-584846-nep/+merge/146076 Hello, If you delete Payslip Batches, related payslips are not deleted. This fixes the issue. Thanks -- https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-584846-nep/+merge/146076 Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/6.1-opw-584846-nep.
=== modified file 'hr_payroll/hr_payroll.py' --- hr_payroll/hr_payroll.py 2012-01-31 13:36:57 +0000 +++ hr_payroll/hr_payroll.py 2013-02-01 09:33:09 +0000 @@ -234,6 +234,22 @@ def close_payslip_run(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state': 'close'}, context=context) + + def unlink(self, cr, uid, ids, context=None): + if context is None: + context = {} + toremove = [] + payslip_obj = self.pool.get('hr.payslip') + for batches in self.browse(cr, uid, ids, context=context): + if batches['state'] != 'draft': + raise osv.except_osv(_('Warning !'), _('You can not delete a closed payslip batch "%s" ') % batches['name']) + payslip_ids = map(lambda x: x.id, batches.slip_ids) + for payslip in payslip_obj.browse(cr, uid, payslip_ids): + if payslip.state != 'draft': + raise osv.except_osv(_('Warning !'), _('You can not delete payslip batch "%s" due to any of the confirmed payslip') % batches['name']) + payslip_obj.unlink(cr, uid, payslip_ids, context=context) + toremove.append(batches.id) + return super(hr_payslip_run, self).unlink(cr, uid, toremove, context) hr_payslip_run()
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : openerp-dev-gtk@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp