From 170f5885d29e1ae05961ee65097ac752a8c30ae5 Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Sat, 9 Mar 2024 22:39:36 +0100 Subject: [PATCH 01/17] Version 7.0.1 --- README.rst | 4 ++-- tryton.cfg | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 51a3cf8..2fde688 100644 --- a/README.rst +++ b/README.rst @@ -14,6 +14,6 @@ Requires Changes ======= -*7.0.0 - 24.02.2024* +*7.0.1 - 09.03.2024* -- init \ No newline at end of file +- works diff --git a/tryton.cfg b/tryton.cfg index e414f70..d2662ec 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=7.0.0 +version=7.0.1 depends: cashbook extras_depend: From b47517c4d8dc3cd634bfb6586adcee124e5e7e68 Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Sun, 10 Mar 2024 07:45:24 +0100 Subject: [PATCH 03/17] fix permissions --- group.xml | 1 + ir.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/group.xml b/group.xml index 5ae80f0..105a2ef 100644 --- a/group.xml +++ b/group.xml @@ -7,6 +7,7 @@ full copyright notices and license terms. --> Cashbook - Scheduled Bookings + diff --git a/ir.py b/ir.py index 7cfd296..d3ec250 100644 --- a/ir.py +++ b/ir.py @@ -14,7 +14,9 @@ class Rule(metaclass=PoolMeta): """ list of models to add 'user_id' to context """ result = super(Rule, cls)._context_modelnames() - result.append('cashbook.planner') + result.extend([ + 'cashbook.planner', + 'cashbook.planner.nextrun']) return result # end Rule From 12839d06db13a8e6bfea38eb7ceb828e37d27849 Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Sun, 10 Mar 2024 07:47:04 +0100 Subject: [PATCH 04/17] Version 7.0.2 --- README.rst | 4 ++++ tryton.cfg | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 2fde688..0a26f3c 100644 --- a/README.rst +++ b/README.rst @@ -14,6 +14,10 @@ Requires Changes ======= +*7.0.2 - 10.03.2024* + +- fix permissions + *7.0.1 - 09.03.2024* - works diff --git a/tryton.cfg b/tryton.cfg index d2662ec..7e3fd9c 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=7.0.1 +version=7.0.2 depends: cashbook extras_depend: From 722b265c332d230cb62d3dc5470090945ca45ea4 Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Sun, 10 Mar 2024 22:21:00 +0100 Subject: [PATCH 06/17] add placeholder 'rate' --- locale/de.po | 8 ++++++-- locale/en.po | 8 ++++++-- planner.py | 12 +++++++++++- tests/planner.py | 7 ++++--- view/planner_form.xml | 2 +- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/locale/de.po b/locale/de.po index 92cfe06..4cd94d0 100644 --- a/locale/de.po +++ b/locale/de.po @@ -107,8 +107,8 @@ msgid "Booking text" msgstr "Buchungstext" msgctxt "view:cashbook.planner:" -msgid "Available placeholders: ${date} ${month} ${year} ${amount} ${quantity}" -msgstr "verfügbare Platzhalter: ${date} ${month} ${year} ${amount} ${quantity}" +msgid "Available placeholders: ${date} ${month} ${year} ${amount} ${quantity} ${rate}" +msgstr "verfügbare Platzhalter: ${date} ${month} ${year} ${amount} ${quantity} ${rate}" msgctxt "view:cashbook.planner:" msgid "Cashbook lines" @@ -318,6 +318,10 @@ msgctxt "help:cashbook.planner,cashbook_lines:" msgid "This cash book lines was generated by the current scheduled booking." msgstr "Diese Kassenbuchzeilen wurden durch die aktuelle geplante Buchung generiert." +msgctxt "field:cashbook.planner,party:" +msgid "Party" +msgstr "Partei" + ############################ # cashbook.planner.nextrun # diff --git a/locale/en.po b/locale/en.po index a556b20..f4994ad 100644 --- a/locale/en.po +++ b/locale/en.po @@ -83,8 +83,8 @@ msgid "Booking text" msgstr "Booking text" msgctxt "view:cashbook.planner:" -msgid "Available placeholders: ${date} ${month} ${year} ${amount} ${quantity}" -msgstr "Available placeholders: ${date} ${month} ${year} ${amount} ${quantity}" +msgid "Available placeholders: ${date} ${month} ${year} ${amount} ${quantity} ${rate}" +msgstr "Available placeholders: ${date} ${month} ${year} ${amount} ${quantity} ${rate}" msgctxt "view:cashbook.planner:" msgid "Cashbook lines" @@ -294,6 +294,10 @@ msgctxt "help:cashbook.planner,cashbook_lines:" msgid "This cash book lines was generated by the current scheduled booking." msgstr "This cash book lines was generated by the current scheduled booking." +msgctxt "field:cashbook.planner,party:" +msgid "Party" +msgstr "Party" + msgctxt "model:cashbook.planner.nextrun,name:" msgid "Next Execution Date" msgstr "Next Execution Date" diff --git a/planner.py b/planner.py index eb07b1e..7f701dc 100644 --- a/planner.py +++ b/planner.py @@ -515,6 +515,15 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView): quantity_txt = Report.format_number( quantity, lang=None, digits=uom_digits) + asset_rate = '-' + if quantity and amount is not None: + asset_rate = '%(rate)s %(currency)s/%(uom)s' % { + 'rate': Report.format_number( + amount / quantity, lang=None, + digits=to_book.currency.digits), + 'currency': to_book.currency.symbol, + 'uom': to_book.quantity_uom.symbol} + return Template(linedata.get('description')).safe_substitute({ 'date': Report.format_date(line_date, lang=None), 'month': line_date.month, @@ -522,7 +531,8 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView): 'amount': Report.format_currency( amount, lang=None, currency=from_book.currency) if (amount is not None) and from_book else '-', - 'quantity': quantity_txt}) + 'quantity': quantity_txt, + 'rate': asset_rate}) @classmethod def update_next_occurence(cls, records, query_date=None): diff --git a/tests/planner.py b/tests/planner.py index 9eaa7b2..eb3389f 100644 --- a/tests/planner.py +++ b/tests/planner.py @@ -364,12 +364,13 @@ class PlannerTestCase(object): asset_book = self.prep_planner_asset_book() self.assertEqual(Planner.fill_placeholder({ 'date': date(2022, 5, 2), - 'amount': Decimal('12.4567'), + 'amount': Decimal('126.4567'), 'quantity': Decimal('32.4423'), 'cashbook': asset_book.id, + 'booktransf': asset_book.id, 'description': '- ${amount} - ${date} - ${month} - ' + - '${year} - ${quantity}'}), - '- usd12.46 - 05/02/2022 - 5 - 2022 - 32.4423\xa0u') + '${year} - ${quantity} - ${rate}'}), + '- usd126.46 - 05/02/2022 - 5 - 2022 - 32.4423\xa0u - 3.90 usd/u') @with_transaction() def test_planner_cronjobs_booking_with_category(self): diff --git a/view/planner_form.xml b/view/planner_form.xml index 95e04e8..9baf580 100644 --- a/view/planner_form.xml +++ b/view/planner_form.xml @@ -59,7 +59,7 @@ full copyright notices and license terms. -->