From 9b1229f4cd8c46753421a250665f015b904a355c Mon Sep 17 00:00:00 2001 From: Loic Oberle Date: Fri, 29 May 2026 10:28:10 +0200 Subject: [PATCH] =?UTF-8?q?refactor(sales=5Finvoice):=20replace=20sql=20wi?= =?UTF-8?q?th=20orm=20in=20clear=5Funallocated=5Fmo=E2=80=A6=20(#55383)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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(