mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 20:29:09 +00:00
test: assert total debit and credit for trx currency
This commit is contained in:
@@ -2656,6 +2656,36 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin):
|
|||||||
"Buying Settings", "bill_for_rejected_quantity_in_purchase_invoice", original_value
|
"Buying Settings", "bill_for_rejected_quantity_in_purchase_invoice", original_value
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_trx_currency_debit_credit_for_high_precision(self):
|
||||||
|
exc_rate = 0.737517516
|
||||||
|
pi = make_purchase_invoice(
|
||||||
|
currency="USD", conversion_rate=exc_rate, qty=1, rate=2000, do_not_save=True
|
||||||
|
)
|
||||||
|
pi.supplier = "_Test Supplier USD"
|
||||||
|
pi.save().submit()
|
||||||
|
|
||||||
|
expected = (
|
||||||
|
("_Test Account Cost for Goods Sold - _TC", 1475.04, 0.0, 2000.0, 0.0, "USD", exc_rate),
|
||||||
|
("_Test Payable USD - _TC", 0.0, 1475.04, 0.0, 2000.0, "USD", exc_rate),
|
||||||
|
)
|
||||||
|
|
||||||
|
actual = frappe.db.get_all(
|
||||||
|
"GL Entry",
|
||||||
|
filters={"voucher_no": pi.name},
|
||||||
|
fields=[
|
||||||
|
"account",
|
||||||
|
"debit",
|
||||||
|
"credit",
|
||||||
|
"debit_in_transaction_currency",
|
||||||
|
"credit_in_transaction_currency",
|
||||||
|
"transaction_currency",
|
||||||
|
"transaction_exchange_rate",
|
||||||
|
],
|
||||||
|
order_by="account",
|
||||||
|
as_list=1,
|
||||||
|
)
|
||||||
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
|
|
||||||
def set_advance_flag(company, flag, default_account):
|
def set_advance_flag(company, flag, default_account):
|
||||||
frappe.db.set_value(
|
frappe.db.set_value(
|
||||||
|
|||||||
Reference in New Issue
Block a user