Merge pull request #47898 from aerele/pegged-currency

Pegged currency
This commit is contained in:
Karuppasamy
2025-06-17 15:08:31 +05:30
committed by GitHub
parent 01cd3b6712
commit cec0ffad06
15 changed files with 302 additions and 19 deletions

View File

@@ -6,6 +6,7 @@ from frappe.tests import IntegrationTestCase, change_settings
from frappe.utils import add_days, add_months, flt, getdate, nowdate
from erpnext.controllers.accounts_controller import InvalidQtyError
from erpnext.setup.utils import get_exchange_rate
EXTRA_TEST_RECORD_DEPENDENCIES = ["Product Bundle"]
@@ -863,6 +864,24 @@ class TestQuotation(IntegrationTestCase):
quotation.reload()
self.assertEqual(quotation.status, "Ordered")
@change_settings("Accounts Settings", {"allow_pegged_currencies_exchange_rates": True})
def test_make_quotation_qar_to_inr(self):
quotation = make_quotation(
currency="QAR",
transaction_date="2026-06-04",
)
cache = frappe.cache()
key = "currency_exchange_rate_{}:{}:{}".format("2026-06-04", "QAR", "INR")
value = cache.get(key)
expected_rate = flt(value) / 3.64
self.assertEqual(
quotation.conversion_rate,
expected_rate,
f"Expected conversion rate {expected_rate}, got {quotation.conversion_rate}",
)
def enable_calculate_bundle_price(enable=1):
selling_settings = frappe.get_doc("Selling Settings")