Odoo modules related to surveys
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
619 B

from odoo import models, fields, api, _
class SurveyUserInput(models.Model):
_inherit = "survey.user_input"
duration = fields.Integer(
string="Duration",
compute="_get_duration",
store=True,
help="Duration in hours",
)
@api.depends("start_datetime", "end_datetime")
def _get_duration(self):
for input in self:
start = input.start_datetime
done = input.end_datetime
if not (start and done):
input.duration = 0
else:
input.duration = int((done - start).total_seconds()) / 3600