get_query to server side

This commit is contained in:
Saurabh
2013-07-10 17:35:14 +05:30
parent a29b69245e
commit ee85cfd476
13 changed files with 116 additions and 83 deletions

View File

@@ -153,13 +153,14 @@ def gl_entry_details(doctype, txt, searchfield, start, page_len, filters):
or ifnull(gle.against_voucher, '') = gle.voucher_no )
and ifnull(gle.%(account_type)s, 0) > 0
and (select ifnull(abs(sum(ifnull(debit, 0))
- sum(ifnull(credit, 0))), 0)
- sum(ifnull(credit, 0))), 0)
from `tabGL Entry`
where against_voucher_type = '%(dt)s'
and against_voucher = gle.voucher_no
and voucher_no != gle.voucher_no
and ifnull(is_cancelled, 'No') = 'No')
!= abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0))
!= abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0)
)
%(mcond)s
ORDER BY gle.posting_date desc, gle.voucher_no desc
limit %(start)s, %(page_len)s""" % {dt:filters["dt"], acc:filters["acc"],

View File

@@ -55,7 +55,7 @@ cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
return{
filters:{
'company_name': doc.company,
'group_or_ledger': "Ledger",
'group_or_ledger': "Ledger"
}
}
}

View File

@@ -990,8 +990,10 @@ def get_income_account(doctype, txt, searchfield, start, page_len, filters):
return webnotes.conn.sql("""select tabAccount.name from `tabAccount`
where (tabAccount.debit_or_credit="Credit"
or tabAccount.account_type = "Income Account")
and tabAccount.group_or_ledger="Ledger" and tabAccount.docstatus!=2
and tabAccount.company = '%(company)s' and tabAccount.%(key)s LIKE '%(txt)s'
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
or tabAccount.account_type = "Income Account")
and tabAccount.group_or_ledger="Ledger"
and tabAccount.docstatus!=2
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, searchfield)})