forked from michel/Coworking
Yesssss
This commit is contained in:
parent
05f69c4aec
commit
5d650a71cb
@ -30,8 +30,10 @@ class Event(models.Model):
|
||||
@api.depends('date_start', 'date_end')
|
||||
def _compute_duration(self):
|
||||
for event in self:
|
||||
if event.duration is True:
|
||||
if event.date_start and event.date_end:
|
||||
t1 = fields.Datetime.from_string(event.date_end)
|
||||
t2 = fields.Datetime.from_string(event.date_start)
|
||||
delta = t1 - t2
|
||||
hours = delta.days * 24.0 + round(float(delta.seconds) / 3600.0)
|
||||
event.duration = delta.days * 24.0 + round(float(delta.seconds) / 3600.0)
|
||||
else:
|
||||
event.duration = 0.0
|
||||
|
Loading…
Reference in New Issue
Block a user