[fix] queries
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index c9a4ff0..e0c3f13 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -410,7 +410,7 @@
and tabAccount.docstatus!=2
and ifnull(tabAccount.master_type, "")=""
and ifnull(tabAccount.master_name, "")=""
- and tabAccount.company = '%(company)s'
- and tabAccount.%(key)s LIKE '%(txt)s'
- %(mcond)s""" % {'company': filters['company'], 'key': searchfield,
- 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype)})
+ and tabAccount.company = %(company)s
+ and tabAccount.{key} LIKE %(txt)s
+ {mcond}""".format(key=searchfield, mcond=get_match_cond(doctype)),
+ {'company': filters['company'], 'txt': "%%{0}%%".format(txt)})
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 676a468..8b23115 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -611,11 +611,10 @@
and tabAccount.docstatus!=2
and ifnull(tabAccount.master_type, "")=""
and ifnull(tabAccount.master_name, "")=""
- and tabAccount.company = '%(company)s'
- and tabAccount.%(key)s LIKE '%(txt)s'
- %(mcond)s""" % {'company': filters['company'], 'key': searchfield,
- 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype)})
-
+ and tabAccount.company = %(company)s
+ and tabAccount.{key} LIKE %(txt)s
+ {mcond}""".format(key=searchfield, mcond=get_match_cond(doctype)),
+ {'company': filters['company'], 'txt': "%%{0}%%".format(txt)})
@frappe.whitelist()
def make_delivery_note(source_name, target_doc=None):
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 a87c4a1..458ae7b 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_last_so_amt(customer):
res = frappe.db.sql("""select net_total from `tabSales Order`
- where customer ='%(customer)s' and docstatus = 1 order by transaction_date desc
- limit 1""" % {'customer':customer})
+ where customer = %(customer)s and docstatus = 1 order by transaction_date desc
+ limit 1""", {'customer':customer})
return res and res[0][0] or 0