[fix] queries

This commit is contained in:
Anand Doshi 2015-02-26 12:40:58 +05:30
parent 2ed025e62d
commit 5bd8cfd9fe
3 changed files with 10 additions and 11 deletions

View File

@ -410,7 +410,7 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
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)})

View File

@ -611,11 +611,10 @@ def get_income_account(doctype, txt, searchfield, start, page_len, filters):
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):

View File

@ -43,8 +43,8 @@ def get_so_details():
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