Skip to content

[19.0][FIX] sale_order_import: propagate line currency - #1385

Open
Ricardoalso wants to merge 1 commit into
OCA:19.0from
camptocamp:sale_order_import_currency_id
Open

[19.0][FIX] sale_order_import: propagate line currency#1385
Ricardoalso wants to merge 1 commit into
OCA:19.0from
camptocamp:sale_order_import_currency_id

Conversation

@Ricardoalso

Copy link
Copy Markdown

_prepare_create_order_line already pre-populated company_id in vals before calling play_onchanges (see f26937d) because sale.order.line.company_id is a related field that ends up empty otherwise. currency_id has the exact same problem -- related, readonly, no inverse -- so play_onchanges drops it from so_vals and later bakes an explicit False into the line's cache, which crashes any percentage/formula pricelist rule with:

ValueError: Expected singleton: res.currency()

Apply the same fix pattern: add _prepare_order_line_get_currency_id, mirroring _prepare_order_line_get_company_id, and pre-populate currency_id in vals before play_onchanges runs.

@OCA-git-bot OCA-git-bot added series:19.0 mod:sale_order_import Module sale_order_import labels Aug 7, 2026
`_prepare_create_order_line` already pre-populated `company_id` in
`vals` before calling `play_onchanges` (see f26937d) because
`sale.order.line.company_id` is a related field that ends up empty
otherwise. `currency_id` has the exact same problem -- related,
readonly, no inverse -- so `play_onchanges` drops it from `so_vals`
and later bakes an explicit `False` into the line's cache, which
crashes any percentage/formula pricelist rule with:

    ValueError: Expected singleton: res.currency()

Apply the same fix pattern: add `_prepare_order_line_get_currency_id`,
mirroring `_prepare_order_line_get_company_id`, and pre-populate
`currency_id` in `vals` before `play_onchanges` runs.
@Ricardoalso
Ricardoalso force-pushed the sale_order_import_currency_id branch from 0b517aa to bd57c5e Compare August 7, 2026 12:36
@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

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.

4 participants