Skip to content

[FIX] purchase_ux: fix currency rate precision in change currency wizard#338

Closed
les-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-t-120310-les
Closed

[FIX] purchase_ux: fix currency rate precision in change currency wizard#338
les-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-t-120310-les

Conversation

@les-adhoc

@les-adhoc les-adhoc commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • _convert(1.0, to_currency) rounds the result to the destination currency's decimal places (e.g. USD = 2), producing 0.00 when converting from ARS → USD and zeroing out all line prices.
  • Fix by using _get_conversion_rate() (raw rate, no rounding) — same approach already used by account_ux.
  • Added digits=(16, 6) to currency_rate field so the rate is stored and displayed with enough precision.

Test plan

  • Crear OC con moneda USD, agregar línea con precio
  • Cambiar moneda a ARS → precio se convierte correctamente
  • Cambiar moneda de vuelta a USD → tasa aparece con 6 decimales (ej. 0.000667), precio se recalcula correctamente (no queda en 0)

Closes #120310

When converting from a high-value currency (e.g. ARS) to a low-value one
(e.g. USD), `_convert(1.0, ...)` rounded the result to the destination
currency's decimal places (2), producing 0.00 and zeroing out all prices.

Fix by using `_get_conversion_rate()` (raw rate, no rounding) — same
approach as account_ux — and adding `digits=(16, 6)` to the field so the
rate is stored and displayed with enough precision.

Closes #120310

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@roboadhoc

Copy link
Copy Markdown
Contributor

Pull request status dashboard

@mav-adhoc

Copy link
Copy Markdown
Contributor

@roboadhoc r+ nobump

roboadhoc pushed a commit that referenced this pull request Jun 17, 2026
When converting from a high-value currency (e.g. ARS) to a low-value one
(e.g. USD), `_convert(1.0, ...)` rounded the result to the destination
currency's decimal places (2), producing 0.00 and zeroing out all prices.

Fix by using `_get_conversion_rate()` (raw rate, no rounding) — same
approach as account_ux — and adding `digits=(16, 6)` to the field so the
rate is stored and displayed with enough precision.

Closes #120310

closes #338

Signed-off-by: Matias Velazquez <mav@adhoc.com.ar>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@roboadhoc roboadhoc closed this in 3352932 Jun 17, 2026
@roboadhoc roboadhoc deleted the 19.0-t-120310-les branch June 17, 2026 19:46
@roboadhoc roboadhoc added the 18.1 label Jun 17, 2026
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.

3 participants