简体   繁体   English

如何在odoo 15的模型数据库中添加时间字段?

[英]How to add Time field in models database in odoo 15?

In Py在 Py

time = fields.Float('Time')

in views在视图中

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

the above method is not working as when I try to record time format such 10:50,It shows invalid error message.上述方法不起作用,因为当我尝试记录时间格式时,例如 10:50,它显示无效的错误消息。 In order to save the window after editing, I have to record time format in float like 10.50 but when saving, it appears in the report 10:39 in time format.为了在编辑后保存窗口,我必须像 10.50 这样以浮点数记录时间格式,但保存时,它以时间格式显示在 10:39 的报告中。

Another problem when I import excel sheet consists of time, It show me an error that i can not import second error image third error image error image] 3导入excel工作表时的另一个问题是时间,它告诉我一个错误,我无法导入第二个错误图像第三个错误图像错误图像] 3

You need to use the float_time widget in the XML definition.您需要在 XML 定义中使用float_time小部件。

Example:例子:

<field name="time" widget='float_time'/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM