mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-09 21:37:38 +00:00
test: add unit test to validate gl values
This commit is contained in:
@@ -962,6 +962,51 @@ class TestPaymentEntry(IntegrationTestCase):
|
||||
self.assertEqual(flt(expected_party_balance), party_balance)
|
||||
self.assertEqual(flt(expected_party_account_balance, 2), flt(party_account_balance, 2))
|
||||
|
||||
def test_gl_of_multi_currency_payment_transaction(self):
|
||||
from erpnext.setup.doctype.currency_exchange.test_currency_exchange import save_new_records
|
||||
|
||||
save_new_records(self.globalTestRecords["Currency Exchange"])
|
||||
paid_from = create_account(
|
||||
parent_account="Current Liabilities - _TC",
|
||||
account_name="Cash USD",
|
||||
company="_Test Company",
|
||||
account_type="Cash",
|
||||
account_currency="USD",
|
||||
)
|
||||
payment_entry = create_payment_entry(
|
||||
party="_Test Supplier USD",
|
||||
paid_from=paid_from,
|
||||
paid_to="_Test Payable USD - _TC",
|
||||
paid_amount=100,
|
||||
save=True,
|
||||
)
|
||||
payment_entry.source_exchange_rate = 84.4
|
||||
payment_entry.target_exchange_rate = 84.4
|
||||
payment_entry.save()
|
||||
payment_entry = payment_entry.submit()
|
||||
gle = qb.DocType("GL Entry")
|
||||
gl_entries = (
|
||||
qb.from_(gle)
|
||||
.select(
|
||||
gle.account,
|
||||
gle.debit,
|
||||
gle.credit,
|
||||
gle.debit_in_account_currency,
|
||||
gle.credit_in_account_currency,
|
||||
gle.debit_in_transaction_currency,
|
||||
gle.credit_in_transaction_currency,
|
||||
)
|
||||
.orderby(gle.account)
|
||||
.where(gle.voucher_no == payment_entry.name)
|
||||
.run()
|
||||
)
|
||||
expected_gl_entries = (
|
||||
("_Test Payable USD - _TC", 8440.0, 0, 100.0, 0.0, 8440.0, 0.0),
|
||||
(paid_from, 0, 8440.0, 0, 100.0, 0, 8440.0),
|
||||
)
|
||||
|
||||
self.assertEqual(gl_entries, expected_gl_entries)
|
||||
|
||||
def test_multi_currency_payment_entry_with_taxes(self):
|
||||
payment_entry = create_payment_entry(
|
||||
party="_Test Supplier USD", paid_to="_Test Payable USD - _TC", save=True
|
||||
|
||||
Reference in New Issue
Block a user