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

There is no field called fields.time in openerp 7.0 how can i achieve this to have only timeWhat is the use of context and get_default method in open erp . As i am new to this , can anyone expalin clearly with example

Note :Widget="float_time" doesnt work instead of time becoz it is allowing to type 99.00 also . Time is only 00.00 - 24.00 ???

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

Hi,

in openerp to display time you can use field.float in python and add attribute widget="float_time for this field.

to limit to 23 hours, 59 minutes and 59 seconds, add an onchange function to test the time, return a raise if this is not the case, for convertion between float time and time date, use "import math" and method math.floor(.....).

Bye

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

ThankYou For the valuble Comment :-) Let me try it:-)

Hi, can you give me an example of how to convert the time data to a float time?.

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

Hi Arun,

See Following example,

in py file,

start_time: fields.float('Start Time')

in xml file,

<field name="start_time" widget="float_time"/>

Hope it works for you.

อวตาร
ละทิ้ง

Becouse How To Select Time ???

'created_time': fields.float('Time'), <field name="created_time" widget="float_time"/> it is not working

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

try this one, it working ..


'duration': fields.integer('Duration', required=True),

 <field name="duration" widget="float_time" class="oe_inline" attrs="{ 'invisible': True }"/>


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Convert widget=float_time to 24h format. แก้ไขแล้ว
1
พ.ค. 21
11920
1
มี.ค. 15
6300
2
มี.ค. 15
5426
1
ธ.ค. 23
1544
0
พ.ย. 23
1718