Nehal Panchal (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-opw-584846-port-nep into
lp:openobject-addons/7.0.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-584846-port-nep/+merge/146080
Hello,
If you delete Payslip Batches, related payslips are not deleted.
This fixes the issue.
Thanks
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-584846-port-nep/+merge/146080
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-opw-584846-port-nep.
=== modified file 'hr_payroll/hr_payroll.py'
--- hr_payroll/hr_payroll.py 2012-12-17 15:23:03 +0000
+++ hr_payroll/hr_payroll.py 2013-02-01 09:44:21 +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 : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp