Odoo Help


Onchange date plus 2 day

on 11/1/16, 4:07 AM 645 views

hi all i have inherit field 'end_date' : fields.date in object sale.order. And i have set product with internal category 'Umum'.

in sale order line i want if product_id.categ_id = Umum , field end date onchange plus (+)2 days.

If annyone can help me with example code. i would be very grateful. Thanks before


Cybrosys Technologies

--Cybrosys Technologies--
| 2 2 4
Calicut, India
--Cybrosys Technologies--

Cybrosys is a well known and highly flourished software development company in India, which provides various services in the IT industry. We are mainly dealing with ERP implementation in both Odoo and .Net, Source Code sale offer for various products and Employee Staffing solutions.

Odoo is the Key service of our company and we have cultivated many potential partners and clients in Europe, Asia, Middle East and Africa within a short span of time. We are really glad to be a part of Odoo and to provide the quality services without any compromise. You can manage the entire project by choosing our experienced and talented developers whenever required. You can feel free to have direct communication with our experts and can assign tasks according to your project plan, the developer will be yours till the end of the work.

Hold your hand with cybrosians to make your Odoo dreams comes true.

Cybrosys Technologies
On 11/1/16, 4:59 AM

Using datetime.timedelta

date_1 = datetime.datetime.strptime(start_date, "%m/%d/%y")

end_date = date_1 + datetime.timedelta(days=2)


Nilmar Shereef

--Nilmar Shereef--
--Nilmar Shereef--

Python Developer. Odoo Techno Functional Consultant.

Nilmar Shereef
On 11/1/16, 5:07 AM

simply import the timedelta like below:

     from datetime import timedelta, datetime

 Then you can assign like below:

     date_today = fields.Date.today()           

    date_object = datetime.strptime(date_today, '%Y-%m-%d')

    v_date = date_object + timedelta(days=15)

Where 15 is the number of days to be added.!
I hope it may help you.

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.


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)


Asked: 11/1/16, 4:07 AM
Seen: 645 times
Last updated: 11/11/16, 7:00 AM