fix: refresh price list exchange rate when currency changes

(cherry picked from commit 8b59d66f94)
This commit is contained in:
khushi8112
2026-09-18 17:34:55 +05:30
committed by Mergify
parent aaaba7cd82
commit 0fe41ce92e

View File

@@ -1066,12 +1066,15 @@ class AccountsController(TransactionBase):
args = "for_buying"
if self.meta.get_field(fieldname) and self.get(fieldname):
previous_price_list_currency = self.price_list_currency
self.price_list_currency = frappe.db.get_value("Price List", self.get(fieldname), "currency")
if self.price_list_currency == self.company_currency:
self.plc_conversion_rate = 1.0
elif not self.plc_conversion_rate:
elif not self.plc_conversion_rate or (
previous_price_list_currency and previous_price_list_currency != self.price_list_currency
):
self.plc_conversion_rate = get_exchange_rate(
self.price_list_currency, self.company_currency, transaction_date, args
)