Message 65471

Message id


ir.cron uses relativedelta and fills it from several fields of the model. Relativedelta itself seems to have no constraints on the range of values used, but it crashes when you try to increase the value of a datetime with a relativedelta(hour=24), with the following backtrace:

Traceback (most recent call last):
File "/tryton/trytond/trytond/ir/", line 134, in run
cron.next_call = cron.compute_next_call(now)
File "/tryton/trytond/trytond/ir/", line 103, in compute_next_call
weekday=int(self.weekday.index) if self.weekday else None))
File "/usr/local/lib/python3.7/dist-packages/dateutil/", line 405, in __radd__
return self.__add__(other)
File "/usr/local/lib/python3.7/dist-packages/dateutil/", line 387, in __add__
ret = (other.replace(**repl)
ValueError: hour must be in 0..23

So we must ensure we follow relativedelta constraints which are:

  • minute must be between 0 and 59
  • hour must be between 0 and 23
  • day does not seem to have a constraint but using a day above 31 will cause the last day of the month to be used

I see two possibilities:

  1. We add a domain on minute and hour fields
  2. We don't add any constraints but use minute=self.minute % 60 and hour=self.hour % 24 when setting relativedelta.


Date User Action Args
2021-03-13 12:01:25albertcasetmessageid: <>
2021-03-13 12:01:25albertcalinkissue10193 messages
2021-03-13 12:01:25albertcacreate

Showing 10 items. Show all history (warning: this could be VERY long)