From 34801602a09dce5c17a266bb9db3dab4a80300a5 Mon Sep 17 00:00:00 2001 From: Antoine Maas Date: Mon, 23 Jun 2025 10:12:07 +0200 Subject: [PATCH 1/2] feat: 3 months recurrence for credit allocation --- .../doctype/booking_credit/booking_credit.py | 9 +++++++- .../booking_credit_allocation_rules.json | 4 ++-- .../booking_credit_allocation_rules.py | 21 +++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/erpnext/venue/doctype/booking_credit/booking_credit.py b/erpnext/venue/doctype/booking_credit/booking_credit.py index 53b7cc99e12..cd883541239 100644 --- a/erpnext/venue/doctype/booking_credit/booking_credit.py +++ b/erpnext/venue/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/erpnext/venue/doctype/booking_credit_allocation_rules/booking_credit_allocation_rules.json b/erpnext/venue/doctype/booking_credit_allocation_rules/booking_credit_allocation_rules.json index 8c52f8cd5a1..02804f1bf82 100644 --- a/erpnext/venue/doctype/booking_credit_allocation_rules/booking_credit_allocation_rules.json +++ b/erpnext/venue/doctype/booking_credit_allocation_rules/booking_credit_allocation_rules.json @@ -32,7 +32,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 }, { @@ -46,7 +46,7 @@ "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2023-03-20 14:50:07.592008", + "modified": "2025-06-23 10:05:25.580530", "modified_by": "Administrator", "module": "Venue", "name": "Booking Credit Allocation Rules", diff --git a/erpnext/venue/doctype/booking_credit_allocation_rules/booking_credit_allocation_rules.py b/erpnext/venue/doctype/booking_credit_allocation_rules/booking_credit_allocation_rules.py index c796093e996..1900a04f1ba 100644 --- a/erpnext/venue/doctype/booking_credit_allocation_rules/booking_credit_allocation_rules.py +++ b/erpnext/venue/doctype/booking_credit_allocation_rules/booking_credit_allocation_rules.py @@ -5,4 +5,25 @@ import frappe from frappe.model.document import Document class BookingCreditAllocationRules(Document): + # begin: auto-generated types + # ruff: noqa + + # This code is auto-generated. Do not modify anything in this block. + + from typing import TYPE_CHECKING + + if TYPE_CHECKING: + from frappe.types import DF + + booking_credit_type: DF.Link + expiration: DF.Int + parent: DF.Data + parentfield: DF.Data + parenttype: DF.Data + quantity: DF.Int + recurrence: DF.Literal["Once", "Every Day", "Every Week", "Every Month", "Every 3 Months", "Every Billing Period"] + # ruff: noqa + # end: auto-generated types + + pass -- GitLab From c8e0ac829f74b93e586e71af0bd12f1f8ec4c42f Mon Sep 17 00:00:00 2001 From: Antoine Maas Date: Mon, 23 Jun 2025 10:13:17 +0200 Subject: [PATCH 2/2] fix: French translations --- erpnext/locale/fr.po | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/locale/fr.po b/erpnext/locale/fr.po index b5e92a90dad..b91872f134f 100644 --- a/erpnext/locale/fr.po +++ b/erpnext/locale/fr.po @@ -65670,3 +65670,9 @@ msgstr "🗃️ Données des projets" #: support/workspace/support/support.json venue/workspace/venue/venue.json msgid "🗃️ Reports & Masters" msgstr "🗃️ Rapports & Données de base" + +#. 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" \ No newline at end of file -- GitLab