Skip to content

[FIX] purchase_deposit: convert deposit amounts to the order currency - #3141

Open
mav-adhoc wants to merge 1 commit into
OCA:18.0from
adhoc-dev:18.0-fix-purchase_deposit-guard-multicurrency-mav
Open

[FIX] purchase_deposit: convert deposit amounts to the order currency#3141
mav-adhoc wants to merge 1 commit into
OCA:18.0from
adhoc-dev:18.0-fix-purchase_deposit-guard-multicurrency-mav

Conversation

@mav-adhoc

@mav-adhoc mav-adhoc commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem

When a deposit bill is posted, AccountMove.action_post writes its price unit back to the deposit line of the purchase order:

line.purchase_line_id.price_unit = line.price_unit

The amount is copied verbatim. A purchase order line holds amounts in the order currency, but the bill may well be issued in a different one — the vendor billing in the company currency while the order is in a foreign one, for instance. In that case the order line ends up holding a figure expressed in the wrong currency, off by the exchange rate.

The divergence is silent: deposit lines carry product_qty = 0, so the wrong figure never reaches the order total and nothing in the UI flags it.

It stops being silent when a further deposit is registered, since create_invoices sums the price unit of the deposit lines to check they do not exceed the order total. One bill in a stronger currency is enough to make that sum exceed the total on its own, so every subsequent deposit fails whatever its amount.

Fix

Convert the amount to the order currency at the bill date. Bills sharing the order currency are unaffected: the conversion rate is 1 and round=False leaves the amount untouched.

Test plan

test_deposit_billed_in_another_currency: an order in a currency worth 1000x the company one, with a 300 deposit whose bill is switched to the company currency and billed as 300000. The order line must still read 300 after posting. Fails without the fix with 300000.0 != 300.0.

Module suite green.

Note this prevents the divergence, it does not repair deposit lines already written with an unconverted amount.

When a deposit bill is posted, its price unit is written back to the
deposit line of the purchase order. The amount was copied verbatim, so a
bill issued in a currency other than the order one left the order line
holding a figure expressed in the wrong currency, off by the exchange
rate.

Convert the amount to the order currency at the bill date. Bills sharing
the order currency are unaffected, the conversion rate is 1 and the
result is not rounded.
@mav-adhoc
mav-adhoc force-pushed the 18.0-fix-purchase_deposit-guard-multicurrency-mav branch from b498a11 to 884686c Compare August 6, 2026 18:52
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