[FIX] purchase_deposit: convert deposit amounts to the order currency - #3141
Open
mav-adhoc wants to merge 1 commit into
Open
[FIX] purchase_deposit: convert deposit amounts to the order currency#3141mav-adhoc wants to merge 1 commit into
mav-adhoc wants to merge 1 commit into
Conversation
mav-adhoc
force-pushed
the
18.0-fix-purchase_deposit-guard-multicurrency-mav
branch
from
August 5, 2026 19:30
9e871e3 to
b498a11
Compare
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
force-pushed
the
18.0-fix-purchase_deposit-guard-multicurrency-mav
branch
from
August 6, 2026 18:52
b498a11 to
884686c
Compare
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.
Problem
When a deposit bill is posted,
AccountMove.action_postwrites its price unit back to the deposit line of the purchase order: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_invoicessums 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=Falseleaves 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 with300000.0 != 300.0.Module suite green.
Note this prevents the divergence, it does not repair deposit lines already written with an unconverted amount.