fix: Show amount of entry based on diff of credit and debit

This commit is contained in:
Suraj Shetty 2019-03-22 14:27:37 +05:30
parent 0aeeb7e02c
commit 67876d1026

View File

@ -62,8 +62,12 @@ class BankReconciliation(Document):
for d in entries:
row = self.append('payment_entries', {})
amount = d.debit if d.debit else d.credit
d.amount = fmt_money(amount, 2, d.account_currency) + " " + (_("Dr") if d.debit else _("Cr"))
amount = d.get('debit', 0) - d.get('credit', 0)
formatted_amount = fmt_money(abs(amount), 2, d.account_currency)
d.amount = formatted_amount + " " + (_("Dr") if amount > 0 else _("Cr"))
d.pop("credit")
d.pop("debit")
d.pop("account_currency")