fix: Don't fetch already discounted invoice
diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py
index 64aa4e4..d1ede67 100644
--- a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py
+++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py
@@ -190,9 +190,11 @@
customer,
posting_date,
outstanding_amount
- from `tabSales Invoice`
+ from `tabSales Invoice` si
where
docstatus = 1
and outstanding_amount > 0
%s
+ and not exists(select di.name from `tabDiscounted Invoice` di
+ where di.docstatus=1 and di.sales_invoice=si.name)
""" % where_condition, filters, as_dict=1)
\ No newline at end of file