mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-14 17:33:09 +00:00
Changing the transaction/posting date re-triggers the `currency` handler, which fetches a fresh exchange rate and, whenever it differs from the current one, divided every Amount-type item margin and Actual tax charge by the new rate. `margin_rate_or_amount` is an amount in the transaction currency, so dividing it is only meaningful when the document actually switches currency; on a mere rate refresh it silently shrinks the margin every time. Track the currency the rendered document is denominated in and convert margins/actual charges only on a real currency change, while still updating `conversion_rate` so base amounts recalculate correctly. Also remove the duplicated `currency()` override in quotation.js: it re-ran the same fetch-and-convert block after `super.currency()` (double converting margins) and lacked the `load_after_mapping` guard. The base handler already covers Quotation via `transaction_date`. Fixes #45210