New field 'move_event' for moving occurence-date if not a business day
This commit is contained in:
parent
353b622074
commit
73a7c1d86c
5 changed files with 64 additions and 0 deletions
20
locale/de.po
20
locale/de.po
|
@ -322,6 +322,26 @@ msgctxt "field:cashbook.planner,party:"
|
||||||
msgid "Party"
|
msgid "Party"
|
||||||
msgstr "Partei"
|
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 #
|
# cashbook.planner.nextrun #
|
||||||
|
|
20
locale/en.po
20
locale/en.po
|
@ -298,6 +298,26 @@ msgctxt "field:cashbook.planner,party:"
|
||||||
msgid "Party"
|
msgid "Party"
|
||||||
msgstr "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:"
|
msgctxt "model:cashbook.planner.nextrun,name:"
|
||||||
msgid "Next Execution Date"
|
msgid "Next Execution Date"
|
||||||
msgstr "Next Execution Date"
|
msgstr "Next Execution Date"
|
||||||
|
|
19
planner.py
19
planner.py
|
@ -34,6 +34,11 @@ SEL_WEEKDAY = [
|
||||||
('0', 'Monday'), ('1', 'Tuesday'), ('2', 'Wednesday'),
|
('0', 'Monday'), ('1', 'Tuesday'), ('2', 'Wednesday'),
|
||||||
('3', 'Thursday'), ('4', 'Friday'), ('5', 'Saturday'),
|
('3', 'Thursday'), ('4', 'Friday'), ('5', 'Saturday'),
|
||||||
('6', 'Sunday')]
|
('6', 'Sunday')]
|
||||||
|
SEL_MOVE_EVENT = [
|
||||||
|
('nop', 'unchanged'),
|
||||||
|
('before', 'Business day before original date'),
|
||||||
|
('after', 'Business day after original date')
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
|
@ -101,6 +106,10 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
nextrun_date = fields.Function(fields.Date(
|
nextrun_date = fields.Function(fields.Date(
|
||||||
string='Next Execution Date', readonly=True),
|
string='Next Execution Date', readonly=True),
|
||||||
'on_change_with_nextrun_date', searcher='search_nextrun_date')
|
'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(
|
bookingtype = fields.Selection(
|
||||||
string='Type', selection=sel_bookingtype, required=True,
|
string='Type', selection=sel_bookingtype, required=True,
|
||||||
|
@ -442,6 +451,16 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
"""
|
"""
|
||||||
return [('nextrun.date',) + tuple(clause[1:])]
|
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
|
@classmethod
|
||||||
def default_wfcheck(cls):
|
def default_wfcheck(cls):
|
||||||
""" False as default for wf-state 'checked'
|
""" False as default for wf-state 'checked'
|
||||||
|
|
|
@ -60,6 +60,7 @@ class PlannerTestCase(object):
|
||||||
self.assertEqual(job.monthday, 1)
|
self.assertEqual(job.monthday, 1)
|
||||||
self.assertEqual(job.interval, 1)
|
self.assertEqual(job.interval, 1)
|
||||||
self.assertEqual(job.setpos, None)
|
self.assertEqual(job.setpos, None)
|
||||||
|
self.assertEqual(job.move_event, 'nop')
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
job.nextdates,
|
job.nextdates,
|
||||||
'05/01/2022 | 06/01/2022 | 07/01/2022 | 08/01/2022 |' +
|
'05/01/2022 | 06/01/2022 | 07/01/2022 | 08/01/2022 |' +
|
||||||
|
|
|
@ -35,6 +35,10 @@ full copyright notices and license terms. -->
|
||||||
<label name="monthday"/>
|
<label name="monthday"/>
|
||||||
<field 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"/>
|
<separator id="sep2" colspan="6" string="Result of the recurrence rule"/>
|
||||||
<field name="nextdates" colspan="6"/>
|
<field name="nextdates" colspan="6"/>
|
||||||
</page>
|
</page>
|
||||||
|
|
Loading…
Reference in a new issue