test: Add test case for payment entry
diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
index d1302f5..801dadc 100644
--- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
@@ -295,6 +295,34 @@
 		outstanding_amount = flt(frappe.db.get_value("Sales Invoice", si.name, "outstanding_amount"))
 		self.assertEqual(outstanding_amount, 80)
 
+	def test_payment_entry_against_si_usd_to_usd_with_deduction_in_base_currency (self):
+		si = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC",
+			currency="USD", conversion_rate=50, do_not_save=1)
+
+		si.plc_conversion_rate = 50
+		si.save()
+		si.submit()
+
+		pe = get_payment_entry("Sales Invoice", si.name, party_amount=20,
+			bank_account="_Test Bank USD - _TC", bank_amount=900)
+
+		pe.source_exchange_rate = 45.263
+		pe.target_exchange_rate = 45.263
+		pe.reference_no = "1"
+		pe.reference_date = "2016-01-01"
+
+
+		pe.append("deductions", {
+			"account": "_Test Exchange Gain/Loss - _TC",
+			"cost_center": "_Test Cost Center - _TC",
+			"amount": 94.80
+		})
+
+		pe.save()
+
+		self.assertEqual(flt(pe.difference_amount, 2), 0.0)
+		self.assertEqual(flt(pe.unallocated_amount, 2), 0.0)
+
 	def test_payment_entry_retrieves_last_exchange_rate(self):
 		from erpnext.setup.doctype.currency_exchange.test_currency_exchange import test_records, save_new_records