diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 2589ce8ee91..9e161e42bd1 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -1034,11 +1034,7 @@ class SalesInvoice(SellingController): def clear_unallocated_mode_of_payments(self): self.set("payments", self.get("payments", {"amount": ["not in", [0, None, ""]]})) - frappe.db.sql( - """delete from `tabSales Invoice Payment` where parent = %s - and amount = 0""", - self.name, - ) + frappe.db.delete("Sales Invoice Payment", filters={"parent": self.name, "amount": 0}) def validate_with_previous_doc(self): super().validate_with_previous_doc(