İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
3449 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Şub 24
3421
2
Tem 25
12102
3
May 24
6730
0
Eyl 20
3284
1
Eki 23
2779