Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
3562 Переглядів

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!

Аватар
Відмінити
Найкраща відповідь

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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
лют. 24
3516
2
лип. 25
12280
3
трав. 24
6866
0
вер. 20
3389
1
жовт. 23
2881