Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Payroll rules with dates

By
Federico Manuel Echeverri Choux
on 3/15/13, 1:28 AM 2,067 views

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

0

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

0
Mario Arias Badila
On 3/16/13, 1:20 PM

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)

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 3/15/13, 1:28 AM
Seen: 2067 times
Last updated: 3/16/15, 8:10 AM