Skip to content

[19.0][IMP] subscription_oca: support invoice and delivery addresses#1453

Merged
OCA-git-bot merged 1 commit into
OCA:19.0from
alvaro-domatix:19.0-imp-subscription_oca-partner-addresses
Jun 25, 2026
Merged

[19.0][IMP] subscription_oca: support invoice and delivery addresses#1453
OCA-git-bot merged 1 commit into
OCA:19.0from
alvaro-domatix:19.0-imp-subscription_oca-partner-addresses

Conversation

@alvaro-domatix

Copy link
Copy Markdown

Adds invoice and delivery addresses on subscriptions, defaulting to the customer's corresponding addresses and overridable per subscription, mirroring sale orders.

Both addresses are propagated to the recurring invoices (the move is addressed to the invoice address and records the delivery address; commercial_partner_id still rolls up to the contracting company, so the receivable stays on the parent) and to the sale orders generated by the subscription.

The fields show under the standard "Display Delivery / Invoice addresses" group.

@OCA-git-bot OCA-git-bot added series:19.0 mod:subscription_oca Module subscription_oca labels Jun 9, 2026
@alvaro-domatix
alvaro-domatix force-pushed the 19.0-imp-subscription_oca-partner-addresses branch 2 times, most recently from 8c1919d to ab4f036 Compare June 9, 2026 20:07
@jelenapoblet
jelenapoblet requested a review from rrebollo June 19, 2026 11:59
@jelenapoblet

Copy link
Copy Markdown

This improvement makes sense, please rebase the branch and update the PR

@szalatyzuzanna szalatyzuzanna left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jorgeglez1990 jorgeglez1990 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rrebollo

Copy link
Copy Markdown

@alvaro-domatix I think rebasing would help resolve the conflicts with the base branch.

@rrebollo rrebollo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: Great work! The code looks good to me (LGTM). Thank you for your contribution! I've provided a few suggestions for your consideration—feel free to address them as you see fit.

"parent_id": cls.customer.id,
}
)
cls.pricelist = cls.env["product.pricelist"].create(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are overwriting the pricelist variable from the core ProductCommon class (defined here). Instead, you could either modify it in place (which is not recommended) or, better yet, create your own pricelist using a different variable name, such as test_pricelist, to avoid unintended side effects on the parent class's behavior.

cls.pricelist = cls.env["product.pricelist"].create(
{"name": "Addr PL", "currency_id": cls.company.currency_id.id}
)
cls.template = cls.env["sale.subscription.template"].create(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefix all the names of these variables to avoid collisions with variables defined higher up in the testing class hierarchy (Accounting < Product < UOM < BaseCommon).

Comment thread subscription_oca/__manifest__.py Outdated
"name": "Subscription management",
"summary": "Generate recurring invoices.",
"version": "19.0.1.0.0",
"version": "19.0.1.1.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, this is handled automatically by the OCA merge bot.

@alvaro-domatix
alvaro-domatix force-pushed the 19.0-imp-subscription_oca-partner-addresses branch from ab4f036 to 36268c5 Compare June 25, 2026 07:12
@alvaro-domatix

Copy link
Copy Markdown
Author

Rebased on top of the current 19.0 (tests/__init__.py keeps both imports, manifest version aligned with 19.0).

@rrebrollo good catch — I've prefixed the test setUp variables (addr_pricelist, addr_template, addr_customer, ...) so they no longer shadow the inherited ProductCommon.pricelist or any other attribute of the common class hierarchy. CI is green.

@pedrobaeza

Copy link
Copy Markdown
Member

With all of these changes, you are converting subscription_oca into contract in complexity terms... I think we should focus in having just one module for the same feature.

@jelenapoblet

Copy link
Copy Markdown

I don't think it will reach the same level of complexity as contract. To me, these improvements are still part of the core subscription domain and make subscription_oca more complete rather than turning it into a contract management module.

@pedrobaeza

Copy link
Copy Markdown
Member

I said "complexity" meaning the same feature set, and yes, you are doing just exactly that: putting the features that contract already has.

@jelenapoblet

Copy link
Copy Markdown

I see your point. My understanding, however, is that the goal is to strengthen subscription_oca as the subscription engine rather than to keep it intentionally limited. I don't think the current improvements bring it to the same scope as contract, but I'd be interested in aligning on the long-term vision for both modules.

Add invoice and delivery addresses on subscriptions, defaulting to the
customer's corresponding addresses and overridable per subscription.

They are propagated to the recurring invoices and to the sale orders
generated by the subscription. As on a sale order invoice, the move is
addressed to the invoice address (account.move.partner_id) and records
the delivery address; commercial_partner_id still rolls up to the
contracting company, so the receivable stays on the parent. The
delivery address is passed explicitly so it is not re-derived from the
invoice partner.

The fields are shown under the "Display Delivery / Invoice addresses"
group, mirroring sale orders.
@alvaro-domatix
alvaro-domatix force-pushed the 19.0-imp-subscription_oca-partner-addresses branch from 36268c5 to 9d27b23 Compare June 25, 2026 10:20
@alvaro-domatix

Copy link
Copy Markdown
Author

Rebased on top of the current 19.0 (tests/__init__.py now keeps test_subscription_recurrence_dates as well). The test variables are still prefixed with addr_ as discussed. CI is green.

@jelenapoblet

Copy link
Copy Markdown

/ocabot merge patch

@OCA-git-bot

Copy link
Copy Markdown
Contributor

On my way to merge this fine PR!
Prepared branch 19.0-ocabot-merge-pr-1453-by-jelenapoblet-bump-patch, awaiting test results.

@OCA-git-bot
OCA-git-bot merged commit b29c2e1 into OCA:19.0 Jun 25, 2026
7 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at faf7e2f. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants