From 6a382f14301001f6042abbc1e487e035ced760bc Mon Sep 17 00:00:00 2001 From: Sugesh393 Date: Wed, 15 Jan 2025 18:27:57 +0530 Subject: [PATCH] test: add new unit test to check payments amount of pos_invoice returns (cherry picked from commit 484ecf24796ecf42d6fe01a23d00ab9245f9a56c) --- .../sales_invoice/test_sales_invoice.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 439fc5639e5..b624be5cf71 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -4245,6 +4245,30 @@ class TestSalesInvoice(FrappeTestCase): doc = frappe.get_doc("Project", project.name) self.assertEqual(doc.total_billed_amount, si.grand_total) + def test_pos_returns_with_party_account_currency(self): + from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_sales_return + + pos_profile = make_pos_profile() + pos_profile.payments = [] + pos_profile.append("payments", {"default": 1, "mode_of_payment": "Cash"}) + pos_profile.save() + + pos = create_sales_invoice( + customer="_Test Customer USD", + currency="USD", + conversion_rate=86.595000000, + qty=2, + do_not_save=True, + ) + pos.is_pos = 1 + pos.pos_profile = pos_profile.name + pos.debit_to = "_Test Receivable USD - _TC" + pos.append("payments", {"mode_of_payment": "Cash", "account": "_Test Bank - _TC", "amount": 20.35}) + pos.save().submit() + + pos_return = make_sales_return(pos.name) + self.assertEqual(abs(pos_return.payments[0].amount), pos.payments[0].amount) + def set_advance_flag(company, flag, default_account): frappe.db.set_value(