0

In 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. 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.

Another problem when I import excel sheet consists of time, It show me an error that i can not import second error imagethird error image error image]3

Pola Pola
  • 1
  • 1
  • 1
    Hi, I tried here with 10:50 as input and I could not produce the error. It is working in my end. Can you please send the error message when you try with 10:50 format input? – Mahbubur Rahman Jul 17 '22 at 19:32

1 Answers1

0

You got that error because you used the wrong field (you didn't define the float_time widget).

You just need to use the float_time widget in the XML definition.

Example:

<field name="field_name" widget='float_time'/>
Kenly
  • 24,317
  • 7
  • 44
  • 60
  • It is not working for the reasons that i have mentioned above as when i record 10.50 in float, it will be converted to 10:39 after saving – Pola Pola Jul 17 '22 at 16:54
  • Please provide the error log, it may be helpful – Kenly Jul 17 '22 at 21:56
  • [1]: https://i.stack.imgur.com/bIc1D.png [2]: https://i.stack.imgur.com/Nv41t.png [3]: https://i.stack.imgur.com/QXIyR.png – Pola Pola Jul 18 '22 at 21:05
  • The value should be automatically [converted to a float](https://github.com/odoo/odoo/blob/9c19460ce7fb1a16cfeed607e474e273f5ce690b/addons/web/static/src/legacy/js/fields/field_utils.js#L645-L657). I do not think you used the correct field. – Kenly Jul 19 '22 at 08:45