[19.0][IMP] subscription_oca: pause and resume subscriptions#1470
Open
alvaro-domatix wants to merge 1 commit into
Open
[19.0][IMP] subscription_oca: pause and resume subscriptions#1470alvaro-domatix wants to merge 1 commit into
alvaro-domatix wants to merge 1 commit into
Conversation
19abf60 to
37024dc
Compare
Add a Boolean `is_paused` (with optional `paused_until` date) on `sale.subscription` so a subscription can be put on hold without closing it. The recurring cron honours the flag and skips paused subscriptions; if `paused_until` is in the past it auto-resumes them in a dedicated helper that the cron runs before the main loop. * `is_paused` Boolean (tracked, partial index). * `paused_until` Date (tracked). * `action_pause(paused_until=None)` — raises on closed or already-paused contracts, posts a chatter line with the resume date if any. * `action_resume(automatic=False)` — raises if not paused, posts a chatter line; the `automatic` flag changes the wording when the resume is triggered by the cron helper. * `_cron_resume_due_subscriptions(limit=None)` — searches paused subs with `paused_until <= today` and resumes them. * `cron_subscription_management` calls the resume helper first and then short-circuits on `is_paused` so paused contracts are never invoiced nor auto-closed by date. UI: * Header buttons "Pause" and "Resume". * Yellow alert banner in the sheet while paused, showing the resume date if scheduled. * Search filters "Paused" and "Active and not paused". This does not touch `stage_id` semantics or the existing stage machine, so installations with custom stages keep working unchanged. Pure additive migration: `-u subscription_oca` adds the two columns with their `False` defaults.
37024dc to
264c24b
Compare
gerard-domatix
approved these changes
Jun 26, 2026
Gerloav
approved these changes
Jun 26, 2026
pablolopez-domatix
approved these changes
Jun 26, 2026
Contributor
|
This PR has the |
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.
Adds the ability to pause and resume a subscription without closing it.
A tracked
is_pausedflag (with an optionalpaused_untildate) is added tosale.subscription. The recurring cron honours the flag: it runs a dedicated resume helper first (auto-resuming any subscription whosepaused_untilhas been reached), then short-circuits onis_pausedso paused contracts are neither invoiced nor auto-closed by date.action_pauseraises on closed or already-paused contracts and optionally schedules a resume date;action_resumereactivates the subscription manually. Both post a chatter line. A Pause wizard lets the user set the resume date from the UI, and a yellow banner shows the paused state (and the scheduled resume date) on the form.Purely additive: it does not touch
stage_idsemantics or the stage machine, so installations with custom stages keep working unchanged.