refactor(test): assert Exc journal when reconciling Journa to invoic

This commit is contained in:
ruthra kumar 2023-06-27 11:16:52 +05:30
parent ee3ce82ea8
commit 389cadf157
2 changed files with 14 additions and 4 deletions

View File

@ -686,14 +686,24 @@ class TestPaymentReconciliation(FrappeTestCase):
# Check if difference journal entry gets generated for difference amount after reconciliation
pr.reconcile()
total_debit_amount = frappe.db.get_all(
total_credit_amount = frappe.db.get_all(
"Journal Entry Account",
{"account": self.debtors_eur, "docstatus": 1, "reference_name": si.name},
"sum(debit) as amount",
"sum(credit) as amount",
group_by="reference_name",
)[0].amount
self.assertEqual(flt(total_debit_amount, 2), -500)
# total credit includes the exchange gain/loss amount
self.assertEqual(flt(total_credit_amount, 2), 8500)
jea_parent = frappe.db.get_all(
"Journal Entry Account",
filters={"account": self.debtors_eur, "docstatus": 1, "reference_name": si.name, "credit": 500},
fields=["parent"],
)[0]
self.assertEqual(
frappe.db.get_value("Journal Entry", jea_parent.parent, "voucher_type"), "Exchange Gain Or Loss"
)
def test_difference_amount_via_payment_entry(self):
# Make Sale Invoice

View File

@ -1038,8 +1038,8 @@ class AccountsController(TransactionBase):
# "reference_type": self.doctype,
# "reference_name": self.name,
# "reference_detail_no": arg.idx,
reverse_dr_or_cr + "_in_account_currency": abs(arg.get("difference_amount")),
reverse_dr_or_cr: abs(arg.get("difference_amount")),
reverse_dr_or_cr + "_in_account_currency": 0,
}
)