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

@ -322,6 +322,26 @@ msgctxt "field:cashbook.planner,party:"
msgid "Party"
msgstr "Partei"
msgctxt "field:cashbook.planner,move_event:"
msgid "If no business day"
msgstr "Wenn kein Werktag"
msgctxt "selection:cashbook.planner,move_event:"
msgid "unchanged"
msgstr "unverändert"
msgctxt "selection:cashbook.planner,move_event:"
msgid "Business day before original date"
msgstr "Geschäftstag vor ursprünglichem Datum"
msgctxt "selection:cashbook.planner,move_event:"
msgid "Business day after original date"
msgstr "Geschäftstag nach ursprünglichem Datum"
msgctxt "help:cashbook.planner,move_event:"
msgid "If the date of execution falls on a weekend or holiday, it can be moved to a business day."
msgstr "Wenn das Datum der Ausführung auf ein Wochenende oder Feiertag fällt, kann es auf einen Geschäftstag verschoben werden."
############################
# cashbook.planner.nextrun #

View file

@ -298,6 +298,26 @@ msgctxt "field:cashbook.planner,party:"
msgid "Party"
msgstr "Party"
msgctxt "field:cashbook.planner,move_event:"
msgid "If no business day"
msgstr "If no business day"
msgctxt "selection:cashbook.planner,move_event:"
msgid "unchanged"
msgstr "unchanged"
msgctxt "selection:cashbook.planner,move_event:"
msgid "Business day before original date"
msgstr "Business day before original date"
msgctxt "selection:cashbook.planner,move_event:"
msgid "Business day after original date"
msgstr "Business day after original date"
msgctxt "help:cashbook.planner,move_event:"
msgid "If the date of execution falls on a weekend or holiday, it can be moved to a business day."
msgstr "If the date of execution falls on a weekend or holiday, it can be moved to a business day."
msgctxt "model:cashbook.planner.nextrun,name:"
msgid "Next Execution Date"
msgstr "Next Execution Date"

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'

View file

@ -60,6 +60,7 @@ class PlannerTestCase(object):
self.assertEqual(job.monthday, 1)
self.assertEqual(job.interval, 1)
self.assertEqual(job.setpos, None)
self.assertEqual(job.move_event, 'nop')
self.assertEqual(
job.nextdates,
'05/01/2022 | 06/01/2022 | 07/01/2022 | 08/01/2022 |' +

View file

@ -35,6 +35,10 @@ full copyright notices and license terms. -->
<label name="monthday"/>
<field name="monthday"/>
<label name="move_event"/>
<field name="move_event"/>
<newline/>
<separator id="sep2" colspan="6" string="Result of the recurrence rule"/>
<field name="nextdates" colspan="6"/>
</page>