test: fix test case for SO/PO advance amount
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index 5206a42..291d756 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -736,27 +736,29 @@
def test_advance_paid_upon_payment_entry_cancellation(self):
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
- po_doc = create_purchase_order()
+ po_doc = create_purchase_order(supplier="_Test Supplier USD", currency="USD", do_not_submit=1)
+ po_doc.conversion_rate = 80
+ po_doc.submit()
- pe = get_payment_entry("Purchase Order", po_doc.name, bank_account="_Test Bank - _TC")
- pe.reference_no = "1"
- pe.reference_date = nowdate()
- pe.paid_from_account_currency = po_doc.currency
- pe.paid_to_account_currency = po_doc.currency
- pe.source_exchange_rate = 1
+ pe = get_payment_entry("Purchase Order", po_doc.name)
+ pe.mode_of_payment = "Cash"
+ pe.paid_from = "Cash - _TC"
+ pe.source_exchange_rate = 80
pe.target_exchange_rate = 1
pe.paid_amount = po_doc.grand_total
pe.save(ignore_permissions=True)
pe.submit()
po_doc.reload()
- self.assertEqual(po_doc.advance_paid, po_doc.base_grand_total)
+ self.assertEqual(po_doc.advance_paid, po_doc.grand_total)
+ self.assertEqual(po_doc.party_account_currency, "USD")
pe_doc = frappe.get_doc("Payment Entry", pe.name)
pe_doc.cancel()
po_doc.reload()
self.assertEqual(po_doc.advance_paid, 0)
+ self.assertEqual(po_doc.party_account_currency, "USD")
def test_schedule_date(self):
po = create_purchase_order(do_not_submit=True)