mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 11:19:09 +00:00
queries to server side
This commit is contained in:
@@ -15,8 +15,11 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
cur_frm.set_query("default_account", function(doc) {
|
||||
return erpnext.queries.account({
|
||||
account_type: "Bank or Cash",
|
||||
company: doc.company
|
||||
});
|
||||
return{
|
||||
query: "controllers.queries.account_query",
|
||||
filters: {
|
||||
'account_type': "Bank or Cash",
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -313,14 +313,16 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
||||
// Income Account in Details Table
|
||||
// --------------------------------
|
||||
cur_frm.set_query("income_account", "entries", function(doc) {
|
||||
return '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="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
|
||||
})
|
||||
return{
|
||||
query: "accounts.doctype.sales_invoice.sales_invoice.get_income_account",
|
||||
filters: {'company': doc.company}
|
||||
}
|
||||
});
|
||||
|
||||
// expense account
|
||||
if (sys_defaults.auto_inventory_accounting) {
|
||||
cur_frm.fields_dict['entries'].grid.get_field('expense_account').get_query = function(doc) {
|
||||
return {
|
||||
// "query": "accounts.utils.get_account_list",
|
||||
filters: {
|
||||
'is_pl_account': 'Yes',
|
||||
'debit_or_credit': 'Debit',
|
||||
|
||||
@@ -984,3 +984,14 @@ def get_bank_cash_account(mode_of_payment):
|
||||
return {
|
||||
"cash_bank_account": val
|
||||
}
|
||||
|
||||
def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
|
||||
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,
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)})
|
||||
Reference in New Issue
Block a user