Skip to content

[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
OCA:19.0from
Jenrax-git:19.0-IMP-subscription_oca-invoice-company-currency
Open

[IMP] subscription_oca:set invoice currency to subscription pricelist and ensure company context in create_invoice#1433
stferraro wants to merge 2 commits into
OCA:19.0from
Jenrax-git:19.0-IMP-subscription_oca-invoice-company-currency

Conversation

@stferraro
Copy link
Copy Markdown

@stferraro stferraro commented May 20, 2026

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:

  1. Ensure invoice values explicitly set currency_id from subscription.pricelist_id.currency_id when preparing account.move values.

  2. Ensure create_invoice runs under subscription.company_id context (with_company) before creating the invoice.

Also add unit tests to validate:

  1. Invoice currency matches subscription pricelist currency.

  2. Invoice company matches subscription company in multi-company scenarios.

Describe alternatives you've considered

  1. Keep this behavior in downstream custom modules only.

  2. 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.

stferraro added 2 commits May 19, 2026 21:30
…icelist and ensure company context in create_invoice
…icelist and ensure company context in create_invoice
@stferraro
Copy link
Copy Markdown
Author

stferraro commented May 20, 2026

Hi, @sbidoul @CristianoMafraJunior @thib-d @yvaucher check this functionality added to subscription oca and approve please

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants