Compare commits
No commits in common. "7504c676e70b11f9335f362197e94b6e7c8c98e4" and "18f194caa573f25efd49cb4cc74f6444f2640599" have entirely different histories.
7504c676e7
...
18f194caa5
8 changed files with 13 additions and 233 deletions
40
locale/de.po
40
locale/de.po
|
@ -3,18 +3,6 @@ msgid ""
|
||||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||||
|
|
||||||
|
|
||||||
##############
|
|
||||||
# ir.message #
|
|
||||||
##############
|
|
||||||
msgctxt "model:ir.message,text:msg_title_notify"
|
|
||||||
msgid "Cashbook Scheduled Booking"
|
|
||||||
msgstr "Kassenbuch geplante Buchung"
|
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_text_notify"
|
|
||||||
msgid "The following transaction was generated: %(bname)s"
|
|
||||||
msgstr "Die folgende Buchung wurde erzeugt: %(bname)s"
|
|
||||||
|
|
||||||
|
|
||||||
###########
|
###########
|
||||||
# ir.cron #
|
# ir.cron #
|
||||||
###########
|
###########
|
||||||
|
@ -47,18 +35,6 @@ msgid "Scheduled Bookings"
|
||||||
msgstr "geplante Buchungen"
|
msgstr "geplante Buchungen"
|
||||||
|
|
||||||
|
|
||||||
###################
|
|
||||||
# ir.model.button #
|
|
||||||
###################
|
|
||||||
msgctxt "model:ir.model.button,string:book_now_button"
|
|
||||||
msgid "Execute Booking Now"
|
|
||||||
msgstr "Buchung jetzt ausführen"
|
|
||||||
|
|
||||||
msgctxt "model:ir.model.button,help:book_now_button"
|
|
||||||
msgid "The planned booking is brought forward and executed now. The next posting is then scheduled regularly for the following execution."
|
|
||||||
msgstr "Die geplante Buchung wird vorgezogen und jetzt ausgeführt. Die nächste Buchung wird dann regulär für die nachfolgende Ausführung geplant."
|
|
||||||
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# ir.rule.group #
|
# ir.rule.group #
|
||||||
#################
|
#################
|
||||||
|
@ -390,22 +366,6 @@ 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."
|
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."
|
msgstr "Wenn das Datum der Ausführung auf ein Wochenende oder Feiertag fällt, kann es auf einen Geschäftstag verschoben werden."
|
||||||
|
|
||||||
msgctxt "field:cashbook.planner,last_day_of_month:"
|
|
||||||
msgid "Last day of the month"
|
|
||||||
msgstr "letzer Tag des Monats"
|
|
||||||
|
|
||||||
msgctxt "help:cashbook.planner,last_day_of_month:"
|
|
||||||
msgid "The booking is made on the last day of the month."
|
|
||||||
msgstr "Die Buchung wird am letzten Tag des Monats ausgeführt."
|
|
||||||
|
|
||||||
msgctxt "field:cashbook.planner,notify_bycron:"
|
|
||||||
msgid "Notify"
|
|
||||||
msgstr "Benachrichtigen"
|
|
||||||
|
|
||||||
msgctxt "help:cashbook.planner,notify_bycron:"
|
|
||||||
msgid "A notification will appear in the web browser when the booking has been created."
|
|
||||||
msgstr "Es wird eine Benachrichtigung im Webbrowser angezeigt wenn die Buchung erstellt wurde."
|
|
||||||
|
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# cashbook.planner.nextrun #
|
# cashbook.planner.nextrun #
|
||||||
|
|
31
locale/en.po
31
locale/en.po
|
@ -2,14 +2,6 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_title_notify"
|
|
||||||
msgid "Cashbook Scheduled Booking"
|
|
||||||
msgstr "Cashbook Scheduled Booking"
|
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_text_notify"
|
|
||||||
msgid "The following transaction was generated: %(bname)s"
|
|
||||||
msgstr "The following transaction was generated: %(bname)s"
|
|
||||||
|
|
||||||
msgctxt "selection:ir.cron,method:"
|
msgctxt "selection:ir.cron,method:"
|
||||||
msgid "Execute scheduled bookings"
|
msgid "Execute scheduled bookings"
|
||||||
msgstr "Execute scheduled bookings"
|
msgstr "Execute scheduled bookings"
|
||||||
|
@ -26,14 +18,6 @@ msgctxt "model:ir.action,name:act_planner_view"
|
||||||
msgid "Scheduled Bookings"
|
msgid "Scheduled Bookings"
|
||||||
msgstr "Scheduled Bookings"
|
msgstr "Scheduled Bookings"
|
||||||
|
|
||||||
msgctxt "model:ir.model.button,string:book_now_button"
|
|
||||||
msgid "Execute Booking Now"
|
|
||||||
msgstr "Execute Booking Now"
|
|
||||||
|
|
||||||
msgctxt "model:ir.model.button,help:book_now_button"
|
|
||||||
msgid "The planned booking is brought forward and executed now. The next posting is then scheduled regularly for the following execution."
|
|
||||||
msgstr "The planned booking is brought forward and executed now. The next posting is then scheduled regularly for the following execution."
|
|
||||||
|
|
||||||
msgctxt "model:ir.rule.group,name:rg_planner_admin"
|
msgctxt "model:ir.rule.group,name:rg_planner_admin"
|
||||||
msgid "Administrators: scheduled bookings read/write"
|
msgid "Administrators: scheduled bookings read/write"
|
||||||
msgstr "Administrators: scheduled bookings read/write"
|
msgstr "Administrators: scheduled bookings read/write"
|
||||||
|
@ -390,18 +374,3 @@ msgctxt "view:cashbook.line:"
|
||||||
msgid "Scheduled Bookings"
|
msgid "Scheduled Bookings"
|
||||||
msgstr "Scheduled Bookings"
|
msgstr "Scheduled Bookings"
|
||||||
|
|
||||||
msgctxt "field:cashbook.planner,last_day_of_month:"
|
|
||||||
msgid "Last day of the month"
|
|
||||||
msgstr "Last day of the month"
|
|
||||||
|
|
||||||
msgctxt "help:cashbook.planner,last_day_of_month:"
|
|
||||||
msgid "The booking is made on the last day of the month."
|
|
||||||
msgstr "The booking is made on the last day of the month."
|
|
||||||
|
|
||||||
msgctxt "field:cashbook.planner,notify_bycron:"
|
|
||||||
msgid "Notify"
|
|
||||||
msgstr "Notify"
|
|
||||||
|
|
||||||
msgctxt "help:cashbook.planner,notify_bycron:"
|
|
||||||
msgid "A notification will appear in the web browser when the booking has been created."
|
|
||||||
msgstr "A notification will appear in the web browser when the booking has been created."
|
|
||||||
|
|
16
message.xml
16
message.xml
|
@ -1,16 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<!-- This file is part of the cashbook-planner from m-ds for Tryton.
|
|
||||||
The COPYRIGHT file at the top level of this repository contains the
|
|
||||||
full copyright notices and license terms. -->
|
|
||||||
<tryton>
|
|
||||||
<data>
|
|
||||||
|
|
||||||
<record model="ir.message" id="msg_title_notify">
|
|
||||||
<field name="text">Cashbook Scheduled Booking</field>
|
|
||||||
</record>
|
|
||||||
<record model="ir.message" id="msg_text_notify">
|
|
||||||
<field name="text">The following transaction was generated: %(bname)s</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</data>
|
|
||||||
</tryton>
|
|
110
planner.py
110
planner.py
|
@ -14,7 +14,6 @@ from trytond.pool import Pool
|
||||||
from trytond.report import Report
|
from trytond.report import Report
|
||||||
from trytond.i18n import gettext
|
from trytond.i18n import gettext
|
||||||
from trytond.pyson import Eval, Bool, If, And
|
from trytond.pyson import Eval, Bool, If, And
|
||||||
from trytond.bus import notify
|
|
||||||
from trytond.modules.currency.fields import Monetary
|
from trytond.modules.currency.fields import Monetary
|
||||||
from trytond.modules.cashbook.book import sel_state_book
|
from trytond.modules.cashbook.book import sel_state_book
|
||||||
from trytond.modules.cashbook.line import sel_bookingtype as sel_bookingtype_cb
|
from trytond.modules.cashbook.line import sel_bookingtype as sel_bookingtype_cb
|
||||||
|
@ -92,14 +91,7 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
[('monthday', '>=', 1), ('monthday', '<=', 31)],
|
[('monthday', '>=', 1), ('monthday', '<=', 31)],
|
||||||
('monthday', '=', None))],
|
('monthday', '=', None))],
|
||||||
depends=['weekday', 'frequ'],
|
depends=['weekday', 'frequ'],
|
||||||
states={
|
states={'required': COND_MONTHDAY, 'invisible': ~COND_MONTHDAY})
|
||||||
'required': And(COND_MONTHDAY, ~Eval('last_day_of_month', False)),
|
|
||||||
'invisible': ~And(
|
|
||||||
COND_MONTHDAY, ~Eval('last_day_of_month', False))})
|
|
||||||
last_day_of_month = fields.Boolean(
|
|
||||||
string='Last day of the month', depends=['weekday', 'frequ'],
|
|
||||||
help='The booking is made on the last day of the month.',
|
|
||||||
states={'invisible': ~COND_MONTHDAY})
|
|
||||||
interval = fields.Integer(
|
interval = fields.Integer(
|
||||||
string='Interval', required=True,
|
string='Interval', required=True,
|
||||||
help='Select an interval to run the rule on every n-th date.',
|
help='Select an interval to run the rule on every n-th date.',
|
||||||
|
@ -118,9 +110,6 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
string='If no business day', required=True, selection=SEL_MOVE_EVENT,
|
string='If no business day', required=True, selection=SEL_MOVE_EVENT,
|
||||||
help='If the date of execution falls on a weekend or holiday, ' +
|
help='If the date of execution falls on a weekend or holiday, ' +
|
||||||
'it can be moved to a business day.')
|
'it can be moved to a business day.')
|
||||||
notify_bycron = fields.Boolean(
|
|
||||||
string='Notify', help='A notification will appear in the web ' +
|
|
||||||
'browser when the booking has been created.')
|
|
||||||
|
|
||||||
bookingtype = fields.Selection(
|
bookingtype = fields.Selection(
|
||||||
string='Type', selection=sel_bookingtype, required=True,
|
string='Type', selection=sel_bookingtype, required=True,
|
||||||
|
@ -191,10 +180,8 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
Index(
|
Index(
|
||||||
t,
|
t,
|
||||||
(t.end_date, Index.Range(order='ASC')),
|
(t.end_date, Index.Range(order='ASC')),
|
||||||
where=t.end_date != DEF_NONE)})
|
where=t.end_date != DEF_NONE),
|
||||||
cls._buttons.update({
|
})
|
||||||
'booknow': {'readonly': ~Eval('active', False)},
|
|
||||||
})
|
|
||||||
|
|
||||||
def get_rec_name(self, name=None):
|
def get_rec_name(self, name=None):
|
||||||
""" get formatted name of record
|
""" get formatted name of record
|
||||||
|
@ -276,8 +263,6 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
count = 5
|
count = 5
|
||||||
count = 1 if count < 1 else 100 if count > 100 else count
|
count = 1 if count < 1 else 100 if count > 100 else count
|
||||||
|
|
||||||
last_day_of_month = params.get(
|
|
||||||
'last_day_of_month', self.last_day_of_month)
|
|
||||||
end_date = params.get('end_date', self.end_date)
|
end_date = params.get('end_date', self.end_date)
|
||||||
frequ = pfrequ[params.get('frequ', self.frequ)]
|
frequ = pfrequ[params.get('frequ', self.frequ)]
|
||||||
|
|
||||||
|
@ -298,18 +283,6 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
interval = 1
|
interval = 1
|
||||||
interval = 1 if interval < 1 else 10 if interval > 10 else interval
|
interval = 1 if interval < 1 else 10 if interval > 10 else interval
|
||||||
|
|
||||||
# last-day-of-month: set date short before end of month,
|
|
||||||
# then compute move result to end of month
|
|
||||||
updt_lastday = False
|
|
||||||
if last_day_of_month and (frequ == MONTHLY) and not pweekday:
|
|
||||||
monthday = 28
|
|
||||||
updt_lastday = True
|
|
||||||
|
|
||||||
lastday_valid = last_day_of_month and (
|
|
||||||
frequ == MONTHLY) and (pweekday is None)
|
|
||||||
assert (lastday_valid or not last_day_of_month), \
|
|
||||||
('last-day-of-month can only be used with frequ=month ' +
|
|
||||||
'and weekday=99.')
|
|
||||||
assert (monthday is None) or (pweekday is None), \
|
assert (monthday is None) or (pweekday is None), \
|
||||||
"weekday and monthday cannot be used together"
|
"weekday and monthday cannot be used together"
|
||||||
|
|
||||||
|
@ -324,12 +297,7 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
for x in dtrule:
|
for x in dtrule:
|
||||||
if (query_date and (x.date() >= query_date)) or \
|
if (query_date and (x.date() >= query_date)) or \
|
||||||
(query_date is None):
|
(query_date is None):
|
||||||
x_date = x.date()
|
x_date = get_moved_date(x.date(), move_event)
|
||||||
if updt_lastday:
|
|
||||||
x_date = (
|
|
||||||
(x_date + timedelta(days=5)).replace(day=1) -
|
|
||||||
timedelta(days=1))
|
|
||||||
x_date = get_moved_date(x_date, move_event)
|
|
||||||
|
|
||||||
# if date was re-arranged backwards and we are before
|
# if date was re-arranged backwards and we are before
|
||||||
# query_date - skip it
|
# query_date - skip it
|
||||||
|
@ -400,7 +368,7 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
|
|
||||||
@fields.depends(
|
@fields.depends(
|
||||||
'start_date', 'end_date', 'frequ', 'weekday', 'monthday',
|
'start_date', 'end_date', 'frequ', 'weekday', 'monthday',
|
||||||
'interval', 'setpos', 'move_event', 'last_day_of_month')
|
'interval', 'setpos', 'move_event')
|
||||||
def on_change_with_nextdates(self, name=None):
|
def on_change_with_nextdates(self, name=None):
|
||||||
""" Calculates the next 5 appointments based on the configured rule,
|
""" Calculates the next 5 appointments based on the configured rule,
|
||||||
returns a formatted date list
|
returns a formatted date list
|
||||||
|
@ -433,8 +401,7 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
'weekday': self.weekday,
|
'weekday': self.weekday,
|
||||||
'monthday': self.monthday,
|
'monthday': self.monthday,
|
||||||
'interval': self.interval,
|
'interval': self.interval,
|
||||||
'setpos': self.setpos,
|
'setpos': self.setpos}
|
||||||
'last_day_of_month': self.last_day_of_month}
|
|
||||||
)])
|
)])
|
||||||
|
|
||||||
@fields.depends('cashbook', '_parent_cashbook.owner')
|
@fields.depends('cashbook', '_parent_cashbook.owner')
|
||||||
|
@ -461,33 +428,26 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
elif self.bookingtype in ['mvin', 'mvout']:
|
elif self.bookingtype in ['mvin', 'mvout']:
|
||||||
self.category = None
|
self.category = None
|
||||||
|
|
||||||
@fields.depends(
|
@fields.depends('frequ', 'setpos', 'weekday', 'monthday')
|
||||||
'frequ', 'setpos', 'weekday', 'monthday', 'last_day_of_month')
|
|
||||||
def on_change_frequ(self):
|
def on_change_frequ(self):
|
||||||
""" update fields
|
""" update fields
|
||||||
"""
|
"""
|
||||||
if self.frequ and self.frequ == 'month':
|
if self.frequ and self.frequ == 'month':
|
||||||
if self.weekday:
|
if self.weekday:
|
||||||
if self.weekday == '99':
|
if self.weekday == '99':
|
||||||
if self.last_day_of_month:
|
if self.monthday is None:
|
||||||
self.monthday = None
|
self.monthday = 1
|
||||||
else:
|
|
||||||
if self.monthday is None:
|
|
||||||
self.monthday = 1
|
|
||||||
self.setpos = None
|
self.setpos = None
|
||||||
else:
|
else:
|
||||||
if self.setpos is None:
|
if self.setpos is None:
|
||||||
self.setpos = 1
|
self.setpos = 1
|
||||||
self.monthday = None
|
self.monthday = None
|
||||||
self.last_day_of_month = False
|
|
||||||
else:
|
else:
|
||||||
self.setpos = None
|
self.setpos = None
|
||||||
self.monthday = None
|
self.monthday = None
|
||||||
self.weekday = '99'
|
self.weekday = '99'
|
||||||
self.last_day_of_month = False
|
|
||||||
|
|
||||||
@fields.depends(
|
@fields.depends('frequ', 'setpos', 'weekday', 'monthday')
|
||||||
'frequ', 'setpos', 'weekday', 'monthday', 'last_day_of_month')
|
|
||||||
def on_change_weekday(self):
|
def on_change_weekday(self):
|
||||||
""" clear day-of-month if weekday is used
|
""" clear day-of-month if weekday is used
|
||||||
"""
|
"""
|
||||||
|
@ -586,15 +546,6 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
"""
|
"""
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def default_last_day_of_month(cls):
|
|
||||||
""" get default for last-day-of-month
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
boolean: False
|
|
||||||
"""
|
|
||||||
return False
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_frequ(cls):
|
def default_frequ(cls):
|
||||||
""" get default for frequency
|
""" get default for frequency
|
||||||
|
@ -618,15 +569,6 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
IrDate = Pool().get('ir.date')
|
IrDate = Pool().get('ir.date')
|
||||||
return IrDate.today()
|
return IrDate.today()
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def default_notify_bycron(cls):
|
|
||||||
""" get False as default
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
boolean: False
|
|
||||||
"""
|
|
||||||
return False
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def fill_placeholder(cls, linedata):
|
def fill_placeholder(cls, linedata):
|
||||||
""" replace placeholder in description
|
""" replace placeholder in description
|
||||||
|
@ -745,20 +687,6 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
if to_write:
|
if to_write:
|
||||||
NextRun.write(*to_write)
|
NextRun.write(*to_write)
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@ModelView.button
|
|
||||||
def booknow(cls, records):
|
|
||||||
""" run planned booking now
|
|
||||||
"""
|
|
||||||
to_work = [x for x in records if x.active and x.nextrun_date]
|
|
||||||
cls.run_booking(to_work)
|
|
||||||
|
|
||||||
for record in to_work:
|
|
||||||
if record.active:
|
|
||||||
cls.update_next_occurence(
|
|
||||||
[record],
|
|
||||||
query_date=record.nextrun_date + timedelta(days=1))
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, vlist):
|
def create(cls, vlist):
|
||||||
""" update nextrun-records on create of planner-records
|
""" update nextrun-records on create of planner-records
|
||||||
|
@ -856,27 +784,11 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
|
||||||
else:
|
else:
|
||||||
to_create.append(line)
|
to_create.append(line)
|
||||||
|
|
||||||
to_notify = []
|
|
||||||
if to_create_check:
|
if to_create_check:
|
||||||
lines = Line.create(to_create_check)
|
lines = Line.create(to_create_check)
|
||||||
Line.wfcheck(lines)
|
Line.wfcheck(lines)
|
||||||
to_notify.extend([
|
|
||||||
x for x in lines
|
|
||||||
if x.planners[0].notify_bycron])
|
|
||||||
|
|
||||||
if to_create:
|
if to_create:
|
||||||
lines = Line.create(to_create)
|
Line.create(to_create)
|
||||||
to_notify.extend([
|
|
||||||
x for x in lines
|
|
||||||
if x.planners[0].notify_bycron])
|
|
||||||
|
|
||||||
for line in to_notify:
|
|
||||||
notify(
|
|
||||||
title=gettext('cashbook_planner.msg_title_notify'),
|
|
||||||
body=gettext(
|
|
||||||
'cashbook_planner.msg_text_notify',
|
|
||||||
bname=line.rec_name),
|
|
||||||
user=line.cashbook.owner.id)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def cronjob(cls):
|
def cronjob(cls):
|
||||||
|
|
12
planner.xml
12
planner.xml
|
@ -157,17 +157,5 @@ full copyright notices and license terms. -->
|
||||||
<field name="rule_group" ref="rg_planner_companies"/>
|
<field name="rule_group" ref="rg_planner_companies"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- button -->
|
|
||||||
<record model="ir.model.button" id="book_now_button">
|
|
||||||
<field name="name">booknow</field>
|
|
||||||
<field name="string">Execute Booking Now</field>
|
|
||||||
<field name="help">The planned booking is brought forward and executed now. The next posting is then scheduled regularly for the following execution.</field>
|
|
||||||
<field name="model" search="[('model', '=', 'cashbook.planner')]"/>
|
|
||||||
</record>
|
|
||||||
<record model="ir.model.button-res.group" id="book_now_button-group_planner">
|
|
||||||
<field name="button" ref="book_now_button"/>
|
|
||||||
<field name="group" ref="group_planner"/>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</tryton>
|
</tryton>
|
||||||
|
|
|
@ -245,17 +245,6 @@ class PlannerTestCase(object):
|
||||||
[date(2022, 5, 11), date(2022, 6, 8), date(2022, 7, 13),
|
[date(2022, 5, 11), date(2022, 6, 8), date(2022, 7, 13),
|
||||||
date(2022, 8, 10), date(2022, 9, 14), date(2022, 10, 12)])
|
date(2022, 8, 10), date(2022, 9, 14), date(2022, 10, 12)])
|
||||||
|
|
||||||
# last day of month
|
|
||||||
self.assertEqual(
|
|
||||||
job._compute_dates_by_rrule(
|
|
||||||
query_date=date(2022, 5, 1), count=6,
|
|
||||||
params={
|
|
||||||
'weekday': '99', 'end_date': None, 'frequ': 'month',
|
|
||||||
'interval': 1, 'setpos': None, 'monthday': None,
|
|
||||||
'last_day_of_month': True}),
|
|
||||||
[date(2022, 5, 31), date(2022, 6, 30), date(2022, 7, 31),
|
|
||||||
date(2022, 8, 31), date(2022, 9, 30), date(2022, 10, 31)])
|
|
||||||
|
|
||||||
# set up holidays
|
# set up holidays
|
||||||
cfg1 = Config(
|
cfg1 = Config(
|
||||||
holidays='01-01;05-01;easter:+1;easter:-2;ascension;whitsun:+1')
|
holidays='01-01;05-01;easter:+1;easter:-2;ascension;whitsun:+1')
|
||||||
|
@ -388,23 +377,6 @@ class PlannerTestCase(object):
|
||||||
'setpos': 5, 'monthday': None, 'weekday': '2',
|
'setpos': 5, 'monthday': None, 'weekday': '2',
|
||||||
'end_date': None}])
|
'end_date': None}])
|
||||||
|
|
||||||
@with_transaction()
|
|
||||||
def test_planner_run_booking_now(self):
|
|
||||||
""" create job, press button 'booknow'
|
|
||||||
"""
|
|
||||||
Planner = Pool().get('cashbook.planner')
|
|
||||||
|
|
||||||
job = self.prep_create_job()
|
|
||||||
self.assertEqual(
|
|
||||||
job.rec_name, "Job 1|Book 1|Exp|Cat1|05/01/2022|usd0.00")
|
|
||||||
self.assertEqual(
|
|
||||||
job._compute_dates_by_rrule(
|
|
||||||
count=1, query_date=date(2022, 5, 1)), [
|
|
||||||
date(2022, 5, 1)])
|
|
||||||
Planner.booknow([job])
|
|
||||||
self.assertEqual(
|
|
||||||
job.rec_name, "Job 1|Book 1|Exp|Cat1|06/01/2022|usd0.00")
|
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_planner_create_update_nextrun(self):
|
def test_planner_create_update_nextrun(self):
|
||||||
""" create job, check nextrun-record
|
""" create job, check nextrun-record
|
||||||
|
|
|
@ -5,7 +5,6 @@ depends:
|
||||||
extras_depend:
|
extras_depend:
|
||||||
cashbook_investment
|
cashbook_investment
|
||||||
xml:
|
xml:
|
||||||
message.xml
|
|
||||||
group.xml
|
group.xml
|
||||||
planner.xml
|
planner.xml
|
||||||
nextrun.xml
|
nextrun.xml
|
||||||
|
|
|
@ -12,8 +12,7 @@ full copyright notices and license terms. -->
|
||||||
<label name="active"/>
|
<label name="active"/>
|
||||||
<field name="active"/>
|
<field name="active"/>
|
||||||
|
|
||||||
<button colspan="2" name="booknow"/>
|
<label name="nextrun_date" colspan="5"/>
|
||||||
<label name="nextrun_date" colspan="3"/>
|
|
||||||
<field name="nextrun_date"/>
|
<field name="nextrun_date"/>
|
||||||
|
|
||||||
<notebook colspan="6">
|
<notebook colspan="6">
|
||||||
|
@ -35,8 +34,6 @@ full copyright notices and license terms. -->
|
||||||
<field name="weekday"/>
|
<field name="weekday"/>
|
||||||
<label name="monthday"/>
|
<label name="monthday"/>
|
||||||
<field name="monthday"/>
|
<field name="monthday"/>
|
||||||
<label name="last_day_of_month"/>
|
|
||||||
<field name="last_day_of_month"/>
|
|
||||||
|
|
||||||
<label name="move_event"/>
|
<label name="move_event"/>
|
||||||
<field name="move_event"/>
|
<field name="move_event"/>
|
||||||
|
@ -61,8 +58,7 @@ full copyright notices and license terms. -->
|
||||||
|
|
||||||
<label name="wfcheck"/>
|
<label name="wfcheck"/>
|
||||||
<field name="wfcheck"/>
|
<field name="wfcheck"/>
|
||||||
<label name="notify_bycron"/>
|
<newline/>
|
||||||
<field name="notify_bycron"/>
|
|
||||||
|
|
||||||
<separator name="subject" colspan="4" string="Booking text"/>
|
<separator name="subject" colspan="4" string="Booking text"/>
|
||||||
<field name="subject" colspan="4"/>
|
<field name="subject" colspan="4"/>
|
||||||
|
|
Loading…
Reference in a new issue