Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
7255 มุมมอง

Hi, I need to know how could I know if a date is within the payslip dates ( date_start and date_end )

example date_d = 04/13/2013

if date_start > date_d and date_d < date_end: return = 1 return = 0

Regards

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

ok, but it doesn't work i try with

date_d = 04/13/2013 date_start = str(payslip.date_from ) date_end = str(payslip.date_end)

return date_start <= date_d <= date_end

or

date_d = 04/13/2013 date_start = str(payslip.date_from ) date_end = str(payslip.date_end)

if date_start > date_d and date_d < date_end: return = 1 return = 0

or

date_d = 04/13/2013 date_start = payslip.date_from date_end = payslip.date_end

if date_start > date_d and date_d < date_end: return = 1 return = 0

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

This will do it...

return date_start <= date_d <= date_end

If you mean the values from an actual payslip object, you get them by browsing the payslip object and accessing the date_from and date_to fields...

You can see this in action at compute_sheet method on hr_payroll/hr_payroll.py

for payslip in self.browse(cr, uid, ids, context=context):
    contract_ids = self.get_contract(cr, uid, payslip.employee_id, payslip.date_from, payslip.date_to, context=context)
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
How to create Salary rules? แก้ไขแล้ว
2
มิ.ย. 22
11964
1
พ.ย. 24
1598
Unpaid Leaves Deduction not working แก้ไขแล้ว
16
พ.ย. 23
23409
0
ก.พ. 17
4777
0
ก.พ. 24
1801