summaryrefslogtreecommitdiff
path: root/addons/resource/models
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-01-28 13:58:11 +0000
committerChristophe Simonis <chs@odoo.com>2019-01-28 13:58:11 +0000
commitcf52a04979d7634908c2f0d8eb6a83b7dd614f64 (patch)
tree2f8c25f3fab45268400c4ac6addfa15f1f2d37f0 /addons/resource/models
parentcd1f57e9ded2e8ca81d7290e4b5b95a8776045c6 (diff)
parentd3b8422c9c44557256836bdc0da5480f553eec4d (diff)
[MERGE] forward port branch saas-12.1 up to d3b8422c9c4
closes odoo/odoo#30614
Diffstat (limited to 'addons/resource/models')
-rw-r--r--addons/resource/models/resource.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/resource/models/resource.py b/addons/resource/models/resource.py
index 28d16768a47..55493728f13 100644
--- a/addons/resource/models/resource.py
+++ b/addons/resource/models/resource.py
@@ -186,9 +186,13 @@ class ResourceCalendar(models.Model):
default=lambda self: self._context.get('tz') or self.env.user.tz or 'UTC',
help="This field is used in order to define in which timezone the resources will work.")
+
+ def _get_global_attendances(self):
+ return self.attendance_ids.filtered(lambda attendance: not attendance.date_from and not attendance.date_to and not attendance.resource_id)
+
@api.onchange('attendance_ids')
def _onchange_hours_per_day(self):
- attendances = self.attendance_ids.filtered(lambda attendance: not attendance.date_from and not attendance.date_to)
+ attendances = self._get_global_attendances()
hour_count = 0.0
for attendance in attendances:
hour_count += attendance.hour_to - attendance.hour_from