New field 'move_event' for moving occurence-date if not a business day

This commit is contained in:
Frederik Jaeckel 2024-06-01 13:31:55 +02:00
parent 353b622074
commit 73a7c1d86c
5 changed files with 64 additions and 0 deletions

View file

@ -34,6 +34,11 @@ SEL_WEEKDAY = [
('0', 'Monday'), ('1', 'Tuesday'), ('2', 'Wednesday'),
('3', 'Thursday'), ('4', 'Friday'), ('5', 'Saturday'),
('6', 'Sunday')]
SEL_MOVE_EVENT = [
('nop', 'unchanged'),
('before', 'Business day before original date'),
('after', 'Business day after original date')
]
class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
@ -101,6 +106,10 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
nextrun_date = fields.Function(fields.Date(
string='Next Execution Date', readonly=True),
'on_change_with_nextrun_date', searcher='search_nextrun_date')
move_event = fields.Selection(
string='If no business day', required=True, selection=SEL_MOVE_EVENT,
help='If the date of execution falls on a weekend or holiday, ' +
'it can be moved to a business day.')
bookingtype = fields.Selection(
string='Type', selection=sel_bookingtype, required=True,
@ -442,6 +451,16 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
"""
return [('nextrun.date',) + tuple(clause[1:])]
@classmethod
def default_move_event(cls):
""" 'no operation' as default for
business-day occurence
Returns:
str: nop
"""
return 'nop'
@classmethod
def default_wfcheck(cls):
""" False as default for wf-state 'checked'