diff --git a/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py b/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py index 2b2c550b47..de4c655be9 100644 --- a/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py +++ b/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py @@ -43,8 +43,8 @@ def get_so_details(): def get_last_so_amt(customer): res = frappe.db.sql("""select base_net_total from `tabSales Order` - where customer ='%(customer)s' and docstatus = 1 order by transaction_date desc - limit 1""" % {'customer': frappe.db.escape(customer)}) + where customer = %s and docstatus = 1 order by transaction_date desc + limit 1""", customer) return res and res[0][0] or 0