[FIX] purchase_deposit: convert deposit amounts to the order currency - #3142
Open
mav-adhoc wants to merge 1 commit into
Open
[FIX] purchase_deposit: convert deposit amounts to the order currency#3142mav-adhoc wants to merge 1 commit into
mav-adhoc wants to merge 1 commit into
Conversation
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
19.0-fix-purchase_deposit-guard-multicurrency-mav
branch
from
August 6, 2026 18:53
7495c36 to
66afe92
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.
Forward port of #3141.
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 here: deposit lines carry
product_qty = 0, so the wrong figure never reaches the order total and nothing in the UI flags it. Unlike 18.0, this branch has no check summing the deposit lines against the order total, so nothing surfaces the corrupted amount later either — it just sits in the order line, and a database upgraded from an earlier version carries it along.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.