From ea8d35761f54b80b65af0288da42147dc6f94c18 Mon Sep 17 00:00:00 2001 From: Antoine Maas Date: Mon, 16 Jun 2025 15:06:55 +0200 Subject: [PATCH 1/2] feat: 3 months recurrence for credit allocation --- .../bookings/doctype/booking_credit/booking_credit.py | 9 ++++++++- .../booking_credit_allocation_rule.json | 7 ++++--- .../booking_credit_allocation_rule.py | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/bookings/bookings/doctype/booking_credit/booking_credit.py b/bookings/bookings/doctype/booking_credit/booking_credit.py index 894771a3..bbe29753 100644 --- a/bookings/bookings/doctype/booking_credit/booking_credit.py +++ b/bookings/bookings/doctype/booking_credit/booking_credit.py @@ -183,18 +183,25 @@ def are_subscription_credits_due(date, rule, subscription): if rule.recurrence == "Every Day": frequency = rrule.DAILY + recurrence_interval = 1 elif rule.recurrence == "Every Week": frequency = rrule.WEEKLY + recurrence_interval = 1 elif rule.recurrence == "Every Month": frequency = rrule.MONTHLY + recurrence_interval = 1 + + elif rule.recurrence == "Every 3 Months": + frequency = rrule.MONTHLY + recurrence_interval = 3 end_date = getdate(subscription.cancellation_date or subscription.current_invoice_end) possible_dates = [ getdate(x) for x in rrule.rrule( - frequency, dtstart=get_datetime(subscription.start), until=get_datetime(end_date) + frequency, interval=recurrence_interval, dtstart=get_datetime(subscription.start), until=get_datetime(end_date) ) ] diff --git a/bookings/bookings/doctype/booking_credit_allocation_rule/booking_credit_allocation_rule.json b/bookings/bookings/doctype/booking_credit_allocation_rule/booking_credit_allocation_rule.json index 549bb15b..724db2ad 100644 --- a/bookings/bookings/doctype/booking_credit_allocation_rule/booking_credit_allocation_rule.json +++ b/bookings/bookings/doctype/booking_credit_allocation_rule/booking_credit_allocation_rule.json @@ -49,7 +49,7 @@ "fieldtype": "Select", "in_list_view": 1, "label": "Recurrence", - "options": "Once\nEvery Day\nEvery Week\nEvery Month\nEvery Billing Period", + "options": "Once\nEvery Day\nEvery Week\nEvery Month\nEvery 3 Months\nEvery Billing Period", "reqd": 1 }, { @@ -69,7 +69,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2025-02-17 14:26:47.398321", + "modified": "2025-06-16 14:40:20.614485", "modified_by": "Administrator", "module": "Bookings", "name": "Booking Credit Allocation Rule", @@ -90,7 +90,8 @@ "write": 1 } ], + "row_format": "Dynamic", "sort_field": "creation", "sort_order": "DESC", "states": [] -} \ No newline at end of file +} diff --git a/bookings/bookings/doctype/booking_credit_allocation_rule/booking_credit_allocation_rule.py b/bookings/bookings/doctype/booking_credit_allocation_rule/booking_credit_allocation_rule.py index 1477c2eb..cb50de82 100644 --- a/bookings/bookings/doctype/booking_credit_allocation_rule/booking_credit_allocation_rule.py +++ b/bookings/bookings/doctype/booking_credit_allocation_rule/booking_credit_allocation_rule.py @@ -17,7 +17,7 @@ class BookingCreditAllocationRule(Document): booking_credit_type: DF.Link expiration_days: DF.Int quantity: DF.Int - recurrence: DF.Literal["Once", "Every Day", "Every Week", "Every Month", "Every Billing Period"] + recurrence: DF.Literal["Once", "Every Day", "Every Week", "Every Month", "Every 3 Months", "Every Billing Period"] subscription: DF.Link # end: auto-generated types -- GitLab From d4f42fcf07ee97a80dda47e561fc938af6682954 Mon Sep 17 00:00:00 2001 From: Antoine Maas Date: Tue, 17 Jun 2025 11:11:01 +0200 Subject: [PATCH 2/2] fix: French translations --- bookings/locale/fr.po | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bookings/locale/fr.po b/bookings/locale/fr.po index ce08b2d5..39eecd8b 100644 --- a/bookings/locale/fr.po +++ b/bookings/locale/fr.po @@ -1647,3 +1647,9 @@ msgstr "📑 Contrats" #: bookings/workspace/events_&_resources/events_&_resources.json msgid "🗓️ Events & Resource Bookings" msgstr "🗓️ Evénéments & réservations de ressources" + +#. Option for the 'Recurrence' (Select) field in DocType 'Booking Credit +#. Allocation Rule' +#: bookings/bookings/doctype/booking_credit_allocation_rule/booking_credit_allocation_rule.json +msgid "Every 3 Months" +msgstr "Tout les 3 Mois" -- GitLab