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.

0

how to determine how many mondays there between two dates

By
Giovanny Vizcaya
on 9/28/16, 10:56 PM 170 views

I'm developing a payroll module, and i need to calculate the quantity of mondays between two dates.

I'm Venezuela, there's a salary rule name "Social Security" and the formula is: (((Wage * 12) / 52) * 0.04) * quantity of mondays between dates.


Is there a way to calculates how many mondays are between two dates?

1

Bejaoui Souheil

--Bejaoui Souheil--
808
| 2 1 4
Sousse, Tunisia
--Bejaoui Souheil--

Odoo developer,  functional and technical consultant

souheil_bejaoui@hotmail.fr

Bejaoui Souheil
On 9/29/16, 4:02 AM

Hi,

Try this:

mondays = 0
while date< date2:
     if date.weekday() == 0:
         mondays +=1

     date += relativedelta.relativedelta( days=+1)

Best regards

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

1 follower(s)

Stats

Asked: 9/28/16, 10:56 PM
Seen: 170 times
Last updated: 9/29/16, 4:02 AM