[IMP] subscription_oca:set invoice currency to subscription pricelist and ensure company context in create_invoice#1433
Open
stferraro wants to merge 2 commits into
Conversation
…icelist and ensure company context in create_invoice
…icelist and ensure company context in create_invoice
Author
|
Hi, @sbidoul @CristianoMafraJunior @thib-d @yvaucher check this functionality added to subscription oca and approve please |
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.
In multi-company and multi-currency setups, invoices generated from subscriptions may not consistently enforce:
The subscription pricelist currency on the created invoice.
The subscription company context during invoice creation.
This can lead to inconsistent invoice values or cross-company context issues in downstream implementations.
Describe the solution you'd like
Implement the following in subscription_oca:
Ensure invoice values explicitly set currency_id from subscription.pricelist_id.currency_id when preparing account.move values.
Ensure create_invoice runs under subscription.company_id context (with_company) before creating the invoice.
Also add unit tests to validate:
Invoice currency matches subscription pricelist currency.
Invoice company matches subscription company in multi-company scenarios.
Describe alternatives you've considered
Keep this behavior in downstream custom modules only.
Override invoice creation in each deployment that needs strict multi-company/multi-currency behavior.
These alternatives duplicate logic across projects and increase maintenance cost compared to handling it upstream.
Additional context
I can submit a PR for 19.0 including implementation and tests.