Odoo Help

0

how to determine how many mondays there between two dates

By
Giovanny Vizcaya
on 9/28/16, 10:56 PM 394 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?

2

Bejaoui Souheil

--Bejaoui Souheil--
1051
| 2 1 5
Rennes, France
--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

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

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