add confirm to book-now-button

This commit is contained in:
Frederik Jaeckel 2024-09-29 21:28:41 +02:00
parent 7504c676e7
commit 52cfda485a
6 changed files with 21 additions and 12 deletions

View file

@ -50,14 +50,18 @@ msgstr "geplante Buchungen"
###################
# ir.model.button #
###################
msgctxt "model:ir.model.button,string:book_now_button"
msgctxt "model:ir.model.button,string:book_now_button2"
msgid "Execute Booking Now"
msgstr "Buchung jetzt ausführen"
msgctxt "model:ir.model.button,help:book_now_button"
msgctxt "model:ir.model.button,help:book_now_button2"
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."
msgctxt "model:ir.model.button,cofirm:book_now_button2"
msgid "The booking is now being made. Continue?"
msgstr "Die Buchung wird nun durchgeführt. Fortsetzen?"
#################
# ir.rule.group #

View file

@ -26,14 +26,18 @@ msgctxt "model:ir.action,name:act_planner_view"
msgid "Scheduled Bookings"
msgstr "Scheduled Bookings"
msgctxt "model:ir.model.button,string:book_now_button"
msgctxt "model:ir.model.button,string:book_now_button2"
msgid "Execute Booking Now"
msgstr "Execute Booking Now"
msgctxt "model:ir.model.button,help:book_now_button"
msgctxt "model:ir.model.button,help:book_now_button2"
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.model.button,cofirm:book_now_button2"
msgid "The booking is now being made. Continue?"
msgstr "The booking is now being made. Continue?"
msgctxt "model:ir.rule.group,name:rg_planner_admin"
msgid "Administrators: scheduled bookings read/write"
msgstr "Administrators: scheduled bookings read/write"

View file

@ -193,7 +193,7 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
(t.end_date, Index.Range(order='ASC')),
where=t.end_date != DEF_NONE)})
cls._buttons.update({
'booknow': {'readonly': ~Eval('active', False)},
'book_now': {'readonly': ~Eval('active', False)},
})
def get_rec_name(self, name=None):
@ -747,7 +747,7 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
@classmethod
@ModelView.button
def booknow(cls, records):
def book_now(cls, records):
""" run planned booking now
"""
to_work = [x for x in records if x.active and x.nextrun_date]

View file

@ -158,14 +158,15 @@ full copyright notices and license terms. -->
</record>
<!-- button -->
<record model="ir.model.button" id="book_now_button">
<field name="name">booknow</field>
<record model="ir.model.button" id="book_now_button2">
<field name="name">book_now</field>
<field name="string">Execute Booking Now</field>
<field name="confirm">The booking is now being made. Continue?</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"/>
<record model="ir.model.button-res.group" id="book_now_button2-group_planner">
<field name="button" ref="book_now_button2"/>
<field name="group" ref="group_planner"/>
</record>

View file

@ -401,7 +401,7 @@ class PlannerTestCase(object):
job._compute_dates_by_rrule(
count=1, query_date=date(2022, 5, 1)), [
date(2022, 5, 1)])
Planner.booknow([job])
Planner.book_now([job])
self.assertEqual(
job.rec_name, "Job 1|Book 1|Exp|Cat1|06/01/2022|usd0.00")

View file

@ -12,7 +12,7 @@ full copyright notices and license terms. -->
<label name="active"/>
<field name="active"/>
<button colspan="2" name="booknow"/>
<button colspan="2" name="book_now"/>
<label name="nextrun_date" colspan="3"/>
<field name="nextrun_date"/>