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

Greetings, 


I created a date field in Odoo Studio, I want it to have todays date by default when I create the registry.

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

Hello Alejandro Velasquez, 

Dynamic Default value is Not Support by odoo Studio

If you Want to current Date then we have one more Idea.

You will Create the Fields As Compute

Readonly = False

Stored = True

Dependencies = partner_id


# Please Make Sure in Dependencies it was use every time when you Filling the Data so most probebly use required Fields


Compute

=======

for record in self:

record ['x_studio_date_field_name'] = datetime.datetime.now ()


So in above method when the Customer will change the it will compute and set the Today Date or Datetime.


Thanks ..

For more information Contact us:- https: //kanakinfosystems.com/odoo-development-services

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

You can define a default of today for any date field via context of the Window Action:

{'default_x_studio_date': context_today()}

This is normally used in Odoo to support filters in Search Views, where it needs to be converted by adding .strftime('%Y-%m-%d') but works just fine in Window Actions as I have shown.


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.พ. 24
3418
1
ม.ค. 16
3992
1
ก.ย. 21
3444
0
ก.ย. 20
3277
5
ก.ค. 23
17281