Skip to content

Commit

Permalink
refactor: ignore system generated cr / dr notes on general ledger
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Aug 2, 2024
1 parent 59d5bee commit bb8c9b5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions erpnext/accounts/report/general_ledger/general_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,20 @@ def get_conditions(filters):
if err_journals:
filters.update({"voucher_no_not_in": [x[0] for x in err_journals]})

if filters.get("ignore_cr_dr_notes"):
system_generated_cr_dr_journals = frappe.db.get_all(
"Journal Entry",
filters={
"company": filters.get("company"),
"docstatus": 1,
"voucher_type": ("in", ["Credit Note", "Debit Note"]),
"is_system_generated": 1,
},
as_list=True,
)
if system_generated_cr_dr_journals:
filters.update({"voucher_no_not_in": [x[0] for x in system_generated_cr_dr_journals]})

if filters.get("voucher_no_not_in"):
conditions.append("voucher_no not in %(voucher_no_not_in)s")

Expand Down

0 comments on commit bb8c9b5

Please sign in to comment.