/
This commit is contained in:
parent
d183b8b344
commit
05f69c4aec
@ -31,9 +31,7 @@ class Event(models.Model):
|
|||||||
def _compute_duration(self):
|
def _compute_duration(self):
|
||||||
for event in self:
|
for event in self:
|
||||||
if event.duration is True:
|
if event.duration is True:
|
||||||
fmt = '%Y-%m-%d'
|
|
||||||
t1 = fields.Datetime.from_string(event.date_end)
|
t1 = fields.Datetime.from_string(event.date_end)
|
||||||
t2 = fields.Datetime.from_string(event.date_start)
|
t2 = fields.Datetime.from_string(event.date_start)
|
||||||
d1 = datetime.strptime(t1, fmt)
|
delta = t1 - t2
|
||||||
d2 = datetime.strptime(t2, fmt)
|
hours = delta.days * 24.0 + round(float(delta.seconds) / 3600.0)
|
||||||
daysDiff = str((d2-d1).day)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user