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

increasing the number of months in a function

By
myriam
on 5/15/13, 12:42 PM 912 views

how can we increase the number of months of a date with a value in a function !! please heeelp

0

Borni DHIFI

--Borni DHIFI--
5102
| 6 8 9
Tunis, Tunisia
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 

http://www.linkedin.com/in/borni

Skype : dhifi.borni

Borni DHIFI
On 5/15/13, 1:04 PM

Hi,

from datetime import datetime
from dateutil.relativedelta import relativedelta

def _add_month_date(self, date_octroi,nbr_echeance) :
    date_before_month = datetime.strptime(date_octroi, '%Y-%m-%d') 
    date_after_month = date_before_month+ relativedelta(months=nbr_echeance)
    return  date_after_month

This function takes as parameters your date and number of months and add return months to this date then return a new date.

thanks.

0
myriam
On 5/15/13, 1:16 PM

Thank you so so much for your reply and sorry if I was'nt too clear.. But I want to say that I have already a "date_octroi" for which I need to increase the number of months with the value of the number of deadlines "nbr_echeance"... how can i do it !! please i need your help thanks a lot

I edit my answer it is clear now.

Borni DHIFI
on 5/15/13, 3:18 PM

yes it's so perfect thank you so much :-)

myriam
on 5/16/13, 7:13 AM

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: 5/15/13, 12:42 PM
Seen: 912 times
Last updated: 3/16/15, 8:10 AM