adds test case to confirm that latest exchange rate is automatically selected
diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
index 8be5f6d..8dcee9a 100644
--- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
@@ -112,6 +112,29 @@
outstanding_amount = flt(frappe.db.get_value("Sales Invoice", si.name, "outstanding_amount"))
self.assertEqual(outstanding_amount, 80)
+
+ def test_payment_entry_retrieves_last_exchange_rate(self):
+ pe = frappe.new_doc("Payment Entry")
+ pe.payment_type = "Pay"
+ pe.company = "_Test Company"
+ pe.posting_date = "2016-01-10"
+ pe.paid_from = "_Test Bank USD - _TC"
+ pe.paid_to = "_Test Bank - _TC"
+ pe.paid_amount = 100
+ pe.reference_no = "3"
+ pe.reference_date = nowdate()
+ pe.party_type = "Supplier"
+ pe.party = "_Test Supplier USD"
+
+ pe.setup_party_account_field()
+ pe.set_missing_values()
+ pe.set_exchange_rate()
+ pe.set_amounts()
+
+ self.assertEqual(
+ pe.source_exchange_rate, 65.1,
+ "{0} is not equal to {1}".format(pe.source_exchange_rate, 65.1)
+ )
def test_internal_transfer_usd_to_inr(self):
pe = frappe.new_doc("Payment Entry")