Created on 2021-03-13.12:01:25 by albertca, last changed 1 month ago by yangoon.
So we must ensure we follow relativedelta constraints which are:
minute must be between 0 and 59
hour must be between 0 and 23
I would vote for domains not only for technical reasons, but even more for plausibility of the User Interface. Even if it is possible to set hour > 23 and minute > 59 this doesn' t really add to the logic. Setting hour = 25 and minute = 62 would mean at 1:12? This day or the next day? This just causes confusion.
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 would like keep the possibility to define 'last day of month'. If setting the 31 doesn't provide this feature, it would be nice to have this feature for values > 31. Currently it is possible to set negative values to the field which doesn't make sense either, so there should be a domain at least for negative values, too.
I think we should add domains because it is strict constraint from dateutil and other values do not make sense.
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/cron.py", line 134, in run
cron.next_call = cron.compute_next_call(now)
File "/tryton/trytond/trytond/ir/cron.py", 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/relativedelta.py", line 405, in __radd__
return self.__add__(other)
File "/usr/local/lib/python3.7/dist-packages/dateutil/relativedelta.py", 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:
I see two possibilities:
Opinions?
History | |||
---|---|---|---|
Date | User | Action | Args |
2021-03-13 13:12:39 | yangoon | set | messages:
+ msg65480 nosy: + yangoon |
2021-03-13 12:47:49 | ced | set | messages:
+ msg65479 nosy: + ced status: unread -> chatting |
2021-03-13 12:01:25 | albertca | create |