Skip to Content
Menu
This question has been flagged
1 Reply
2192 Views

Hello,

I am trying to build a new app, using Studio, and I want to have a field that autocompletes with the value of a date I enter into an "input date" field + a number of days.

(I would also like for the number of  days to change according to a box which is either checked or not checked).

Can anyone help me  (I  know  nothing  about  phyton  but  I  understand  coding )?

Thank you!

Avatar
Discard
Best Answer

Hey Leo,

You need to add two fields using studio.
1. x_studio_date_field : date field which will be compute
2. x_studio_no_of_days : integer field which will add the number of days to date field

Here, default x_studio_date_field - Today's date
x_studio_no_of_days - 0

You need to write the below compute method in x_studio_date_field field. You can access Properties and scroll down and click More. Further, you need to write the dependent field x_studio_no_of_days. So every time whenever you change the x_studio_no_of_days it will add to x_studio_date_field date.

for record in self:
record ['x_studio_date_field'] = datetime.datetime.now () + datetime.timedelta(days=record.x_studio_no_of_days)

Thanks & Regards,

Email: odoo@aktivsoftware.com

Skype: kalpeshmaheshwari

Avatar
Discard
Related Posts Replies Views Activity
1
Feb 24
1623
3
May 24
5539
1
Jul 21
9852
0
Sep 20
2400
1
Oct 23
1908