[19.0][ADD] subscription_oca: subscription renewals#1469
Open
alvaro-domatix wants to merge 1 commit into
Open
Conversation
4be868b to
a6fba40
Compare
Add a first-class renewal workflow so a subscription can spawn a child renewal quote, keep the link between both records, and automatically close the parent when the renewal is activated. * `parent_subscription_id` Many2one (self) — points at the contract this one was renewed from. * `origin_subscription_id` recursive computed Many2one (stored) — walks up the chain to the original contract. * `child_subscription_ids` One2many — renewals spawned from this one. * `renewal_count` — convenience compute for the stat button. * `is_renewed` Boolean (stored, partial index) — True when any child is not yet closed. Hides the Renew button while a quote is open. `action_prepare_renewal()` clones template, lines, pricelist, fiscal position, partner and journal into a new subscription in the configured `pre` stage, then chats a link on the parent. Activating that renewal calls `_handle_renewal_activation(child=self)` on the parent, which closes it via `close_subscription()`. UI: * Header button "Renew", visible only when the contract is in progress and there is no active child yet. * Stat buttons "Parent contract" and "Renewals" on the form. * Search filters "Renewals" / "Originals" and a groupby by parent contract. Migration: pure additive. `-u subscription_oca` runs the ORM recompute for `origin_subscription_id` and `is_renewed`; existing subscriptions end up with `False` for both (correct — no genealogy existed before). This does not touch `stage_id` semantics or any pre-existing field, so installations with custom stages keep working unchanged.
a6fba40 to
68372a9
Compare
gerard-domatix
approved these changes
Jun 26, 2026
Gerloav
approved these changes
Jun 26, 2026
javier-domatix
approved these changes
Jun 26, 2026
pablolopez-domatix
approved these changes
Jun 26, 2026
|
I see the value of subscription_oca as a simpler subscription solution with a lower barrier to entry than contract. My concern is the long-term direction. As we continue adding features like renewals, aren't we gradually converging on the same feature set? Would it make sense to explore extending or integrating with contract for some advanced capabilities instead of implementing them independently? I'm not sure it will be sustainable for both modules to evolve in parallel if they end up covering the same use cases. |
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 subscription renewals while keeping the contractual genealogy: a renewal clones the template, lines, pricelist, fiscal position, partner and journal into a new subscription in the configured pre-stage, linked back to its parent.
The parent form gains:
Activating a renewal closes its parent via
close_subscription()(respecting the company), andis_renewed— a stored boolean with a partial index,Truewhile any non-closed child exists — hides the Renew button so a contract cannot be renewed twice in parallel.Purely additive: it does not touch
stage_idsemantics or any pre-existing field, so installations with custom stages keep working. Existing subscriptions simply end up with no parent/child lineage, which is correct.