diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-01-31 16:59:58 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-01-31 16:59:58 +0100 |
| commit | f927c68ddbe4dccbdd0174019d6028d30b0d8058 (patch) | |
| tree | af24ebffe8241ee0c6ec9c911f2fe15f54237bcc /addons/resource | |
| parent | 24ba5ae276a7c25cdcd4d2db2e17e032cfa7e52a (diff) | |
| parent | cb8fefa8999bd0056c2191edbdbbb85918d221da (diff) | |
[MERGE] forward port branch 12.0 up to cb8fefa8999
Diffstat (limited to 'addons/resource')
| -rw-r--r-- | addons/resource/models/resource.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/resource/models/resource.py b/addons/resource/models/resource.py index b16c121799b..fd0e8260fc5 100644 --- a/addons/resource/models/resource.py +++ b/addons/resource/models/resource.py @@ -196,7 +196,8 @@ class ResourceCalendar(models.Model): hour_count = 0.0 for attendance in attendances: hour_count += attendance.hour_to - attendance.hour_from - self.hours_per_day = float_round(hour_count / float(len(set(attendances.mapped('dayofweek')))), precision_digits=2) + if attendances: + self.hours_per_day = float_round(hour_count / float(len(set(attendances.mapped('dayofweek')))), precision_digits=2) # -------------------------------------------------- # Computation API |
