[FIX] lp:1132963, Fix contract selection on payroll within date range
authorthe.clone.master@gmail.com <the.clone.master@gmail.com>
Tue, 23 Apr 2013 06:21:34 +0000 (06:21 +0000)
committerStefan Rijnhart <stefan@therp.nl>
Wed, 2 Jul 2014 17:39:14 +0000 (19:39 +0200)
https://launchpad.net/bugs/1132963

addons/hr_payroll/hr_payroll.py

index 67fb89e..90cf537 100644 (file)
@@ -386,7 +386,7 @@ class hr_payslip(osv.osv):
         #OR if it starts between the given dates
         clause_2 = ['&',('date_start', '<=', date_to),('date_start','>=', date_from)]
         #OR if it starts before the date_from and finish after the date_end (or never finish)
-        clause_3 = [('date_start','<=', date_from),'|',('date_end', '=', False),('date_end','>=', date_to)]
+        clause_3 = ['&',('date_start','<=', date_from),'|',('date_end', '=', False),('date_end','>=', date_to)]
         clause_final =  [('employee_id', '=', employee.id),'|','|'] + clause_1 + clause_2 + clause_3
         contract_ids = contract_obj.search(cr, uid, clause_final, context=context)
         return contract_ids