[IMP] subscription_oca:set invoice currency to subscription pricelist and ensure company context in create_invoice#1433
Conversation
…icelist and ensure company context in create_invoice
|
Hi, @sbidoul @CristianoMafraJunior @thib-d @yvaucher check this functionality added to subscription oca and approve please |
|
Hi @rickard-w please checks this functionality please ! |
c3b0d03 to
9d60448
Compare
…icelist and ensure company context in create_invoice
9d60448 to
bc31d17
Compare
|
@OCA-git-bot mainteiners contract approve |
|
/ocabot merge --no-bump |
|
Hi @stferraro. Your command failed:
Ocabot commands
More information
|
|
Hi @stferraro |
|
Hi @rickard-w , thanks for your comment please approve this PR |
|
Hi @pedrobaeza, when you have a chance, could you please review this PR? Otherwise, could you tag someone who can review and approve it? |
I don't have the permission to approve. And honstly, I don't know if I have the skills either :) |
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.
Multi-Company Security: Ensure proper record rules are defined so users in multi-company environments don't face access errors or leakages.
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.