Merge pull request #47863 from khushi8112/closing-balance-in-dr-cr
feat: show Dr/Cr in Supplier ledger summary & Customer ledger summary
This commit is contained in:
@@ -210,6 +210,7 @@ class PartyLedgerSummaryReport:
|
||||
"fieldtype": "Link",
|
||||
"options": "Currency",
|
||||
"width": 50,
|
||||
"hidden": 1,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -242,6 +243,7 @@ class PartyLedgerSummaryReport:
|
||||
}
|
||||
]
|
||||
|
||||
columns.append({"label": _("Dr/Cr"), "fieldname": "dr_or_cr", "fieldtype": "Data", "width": 100})
|
||||
return columns
|
||||
|
||||
def get_data(self):
|
||||
@@ -300,6 +302,13 @@ class PartyLedgerSummaryReport:
|
||||
for account in self.party_adjustment_accounts:
|
||||
row["adj_" + scrub(account)] = adjustments.get(account, 0)
|
||||
|
||||
if self.filters.party_type == "Customer":
|
||||
balance = row.get("closing_balance", 0)
|
||||
row["dr_or_cr"] = "Dr" if balance > 0 else "Cr" if balance < 0 else ""
|
||||
else:
|
||||
balance = row.get("closing_balance", 0)
|
||||
row["dr_or_cr"] = "Cr" if balance > 0 else "Dr" if balance < 0 else ""
|
||||
|
||||
out.append(row)
|
||||
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user