Ronald Rubi has proposed merging 
lp:~rr.clearcorp/openobject-addons/6.1-ccorp-hr_payroll into 
lp:~clearcorp-drivers/openobject-addons/6.1-ccorp.

Requested reviews:
  CLEARCORP drivers (clearcorp-drivers)

For more details, see:
https://code.launchpad.net/~rr.clearcorp/openobject-addons/6.1-ccorp-hr_payroll/+merge/145930

[MRG] Fix unlink hr_payslip. Patch openerp team
-- 
https://code.launchpad.net/~rr.clearcorp/openobject-addons/6.1-ccorp-hr_payroll/+merge/145930
Your team CLEARCORP development team is subscribed to branch 
lp:~clearcorp-drivers/openobject-addons/6.1-ccorp.
=== 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-01-31 17:41:23 +0000
@@ -305,6 +305,12 @@
         return True
 
     _constraints = [(_check_dates, "Payslip 'Date From' must be before 'Date To'.", ['date_from', 'date_to'])]  
+    
+    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 if its state isn't draft or cancelled!"))
+        return super(hr_payslip, self).unlink(cr, uid, ids, context)    
 
     def copy(self, cr, uid, id, default=None, context=None):
         if not default:

_______________________________________________
Mailing list: https://launchpad.net/~clearcorp
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~clearcorp
More help   : https://help.launchpad.net/ListHelp

Reply via email to