[FIX] stock_calendar : correctly schedule calendar

Bad call to api.multi method.
Introduced at 4cb09653

Closes #15763
This commit is contained in:
Denis Roussel (ACSONE)
2017-03-09 09:10:23 +01:00
committed by Martin Trigaux
parent 2ad0a5a906
commit e4a0a300cb
+1 -2
View File
@@ -34,7 +34,6 @@ class StockWarehouseOrderpoint(models.Model):
"""
# TDE FIXME: unused context key 'no_round_hours' removed
# Check if orderpoint has last execution date and calculate if we need to calculate again already
Calendar = self.env["resource.calendar"]
Attendance = self.env["resource.calendar.attendance"]
group = False
date = False
@@ -46,7 +45,7 @@ class StockWarehouseOrderpoint(models.Model):
else:
new_date = datetime.utcnow()
# TDE note: I bet accessing interval[2] will crash, no ? this code seems very louche
intervals = Calendar._schedule_days(self.purchase_calendar_id.id, 1, new_date, compute_leaves=True)
intervals = self.purchase_calendar_id._schedule_days(1, new_date, compute_leaves=True)
for interval in intervals:
# If last execution date, interval should start after it in order not to execute the same orderpoint twice
# TODO: Make the interval a little bigger