[FIX] purchase_deposit: convert deposit amounts to the order currency - #3141
OCA-git-bot merged 1 commit into
Conversation
9e871e3 to
b498a11
Compare
b498a11 to
884686c
Compare
|
Hi @HviorForgeFlow! Can you review the fix please? Thanks |
884686c to
ebe6fbb
Compare
|
Applied the review suggestions in both branches: the test case now inherits from Heads-up, since this was already approved: the fix itself changed. It used to convert the deposit at the bill date, it now converts at the order rate ( |
ebe6fbb to
639583b
Compare
|
Sorry for the churn: I briefly pushed a version that converted the deposit at the order rate instead of the bill date, and I have reverted it. It looked like the better basis — it is the one The only difference from the version you approved is your two test suggestions, now applied in both branches. Thanks again @BhaveshHeliconia. |
When the vendor bills a deposit in a currency other than the order one, action_post copied the bill figure into the order line verbatim, so an order in a strong currency ended up holding the nominal of a weak one. Convert it at the bill date instead. Deposits billed in the order currency are unaffected: the conversion rate is exactly 1.
639583b to
d09be0d
Compare
|
Dropped the manifest version bump here too, per @HviorForgeFlow's review on #3142 — ocabot does it on merge, so no |
|
For whoever merges: the red |
|
/ocabot merge patch |
|
Hey, thanks for contributing! Proceeding to merge this for you. |
|
Congratulations, your PR was merged at 0d84290. Thanks a lot for contributing to OCA. ❤️ |
What
action_postcopies the deposit amount from the vendor bill back into the purchaseorder line. When the bill is issued in a currency other than the order one the figure
was copied verbatim, so an order in a strong currency ended up with a deposit line
holding the nominal of a weak one — three orders of magnitude off, in the case that
brought us here.
This converts it to the order currency, at the bill date.
Why it matters beyond the wrong figure
The deposit line's
price_unitis not only informative: it is the amount deducted fromthe final bill (
_prepare_account_move_lineputs the deposit line in withquantity = -qty_invoiced), and on 18.0 it is also what the wizard compares against theorder total. So a bill figure landing there unconverted both corrupts the deduction and,
on 18.0, makes any further deposit on that order impossible.
Deposits billed in the order currency are unaffected: the conversion rate is exactly 1.
Test plan
test_deposit_billed_in_another_currency: an order in a currency worth 1000x thecompany one, a deposit of 300, and a bill edited to the company currency for 300,000.
Without the fix the order line ends up at
300000.0; with it, at300.0.Full suite green (7 tests on 18.0, 6 on 19.0).