Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
4112 มุมมอง

Hello, i use Odoo Online, so i can't create custom module here, but i want to compute a date fields here. The problem here, is that i can't import relativedelta from dateutil.relativedelta.


How can i do please ?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

You can do as follow:

new_date = datetime.date.today() + dateutil.relativedelta.relativedelta(days=1)

Thanks

อวตาร
ละทิ้ง
ผู้เขียน

Hello, thank you for your answer, it helped a lot !

คำตอบที่ดีที่สุด

Hi, a need to add a duration to a start_date to compute the end date of a leasing contract in my DB ... And i'm losing my head ;-))

So When you indicate "new_date = datetime.date.today() + dateutil\.relativedelta\.relativedelta\(days=1\)", do\ you\ means\ with\ automated\ action\ \? 


I'm\ trying\ to\ do\ the\ same\ in\ computed\ field,\ but\ it\ is\ not\ working\ \.\.\.

for\ record\ in\ self:
\ \ x_studio_fin_start\ =\ fields\.Datetime\.from_string\(self\.x_studio_fin_start\)
\ \ record\['x_studio_fin_stop'\]\ =\ record\.x_studio_fin_start\ \+\ record.dateutil.relativedelta(months=x_studio_dure_mois)

Could you please help me ?

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ค. 23
2270
Import button is missing แก้ไขแล้ว
1
เม.ย. 23
7618
Import Create and Update Dates แก้ไขแล้ว
1
ต.ค. 21
3414
import in odoo 14 แก้ไขแล้ว
1
มิ.ย. 21
2658
1
ก.พ. 21
10145