feat: add bieannial and triannial billing frequency#8
Open
HenningWendtland wants to merge 4 commits into
Open
Conversation
Member
Author
barredterra
reviewed
Jun 15, 2026
Member
Author
barredterra
reviewed
Jun 16, 2026
Comment on lines
+215
to
+227
| def get_calendar_period( | ||
| eval_date: date, frequency: Frequency, start_date: date | None = None | ||
| ) -> tuple[date, date]: | ||
| """Return the first and last day of the calendar period containing `eval_date`.""" | ||
| if frequency in MULTI_YEAR_FREQUENCIES and not start_date: | ||
| frappe.throw( | ||
| _("Start Date is required for frequency {0}.").format( | ||
| _(frequency.name, context="Frequency of Subscription") | ||
| ) | ||
| ) | ||
|
|
||
| if frequency in MULTI_YEAR_FREQUENCIES: | ||
| years_span = frequency.value // 12 |
Member
There was a problem hiding this comment.
Suggested change
| def get_calendar_period( | |
| eval_date: date, frequency: Frequency, start_date: date | None = None | |
| ) -> tuple[date, date]: | |
| """Return the first and last day of the calendar period containing `eval_date`.""" | |
| if frequency in MULTI_YEAR_FREQUENCIES and not start_date: | |
| frappe.throw( | |
| _("Start Date is required for frequency {0}.").format( | |
| _(frequency.name, context="Frequency of Subscription") | |
| ) | |
| ) | |
| if frequency in MULTI_YEAR_FREQUENCIES: | |
| years_span = frequency.value // 12 | |
| def get_calendar_period( | |
| eval_date: date, frequency: Frequency, start_year: int | None = None | |
| ) -> tuple[date, date]: | |
| """Return the first and last day of the calendar period containing `eval_date`.""" | |
| if frequency in MULTI_YEAR_FREQUENCIES: | |
| if not start_year: | |
| raise ValueError("start_date is required for multi-year frequencies") | |
| years_span = frequency.value // 12 |
- This method only needs the start year, not the entire start date (less for the reader to think about)
- Calendar utils were meant to be independent of frappe, so they should raise regular python exceptions instead of
frappe.throw(). A framework-caller can then catch these and frappe.throw(). This keeps the separation between pure date math and framework clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addition of biennial and triennial billing (every 2 and 3 years).
This was easily possible for the
period_type == "start date"but not for "calendar months" type, so just implemented for the first type.To improve the UI the correct types are displayed dynamically
Reference: AIT-46