test: Add test case for payment entry
This commit is contained in:
		
							parent
							
								
									b1bcb3bf13
								
							
						
					
					
						commit
						fd739749ba
					
				| @ -295,6 +295,34 @@ class TestPaymentEntry(unittest.TestCase): | ||||
| 		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 | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user