Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
5107 Представления

Online Odoo v13 & studio app.

Hi there,


In my task (project) i have 2 datetime fields: start & stop

 i need to calculate the hours between them, so i added following computation on the calculated field:

---

for record in self:

  if record.x_studio_start is set:

      start = record.x_studio_start

      end = record.x_studio_stop

      difference = end - start

      difference_in_seconds = difference.total_seconds()

      record['x_studio_hours_invoiced'] = difference_in_seconds/60**2

---

it worked in a separate (studio)model, but when i want to use the same syntax, it doesn't work.

Any idea would be helpfull !


thx,

roeland

Аватар
Отменить
Лучший ответ

Hi, 

Please try this code,

for record in self:
  if record.x_studio_start is set:
      start = record.x_studio_start
      end = record.x_studio_stop
      difference = end - start
      difference_in_seconds = difference.total_seconds()
      record ['x_studio_hours_invoiced'] = difference_in_seconds / 3600.0

Thanks

Muhammed Ali M - iWesabe

Аватар
Отменить
Лучший ответ

Hello Roeland Vandecan, 

please try this solution

record ['x_studio_hours_invoiced'] = difference_in_seconds / 3600.0

Thanks ...

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
окт. 24
1119
1
июл. 24
2216
1
дек. 22
4580
1
июн. 21
2238
2
нояб. 24
402