[minor] [query] expense and income account queries should exclude customer and supplier accounts
This commit is contained in:
parent
4144b1c841
commit
06757a19ef
@ -469,11 +469,16 @@ class DocType(BuyingController):
|
|||||||
def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
|
def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
|
||||||
from controllers.queries import get_match_cond
|
from controllers.queries import get_match_cond
|
||||||
|
|
||||||
|
# expense account can be any Debit account,
|
||||||
|
# but can also be a Liability account with account_type='Expense Account' in special circumstances.
|
||||||
|
# Hence the first condition is an "OR"
|
||||||
return webnotes.conn.sql("""select tabAccount.name from `tabAccount`
|
return webnotes.conn.sql("""select tabAccount.name from `tabAccount`
|
||||||
where (tabAccount.debit_or_credit="Debit"
|
where (tabAccount.debit_or_credit="Debit"
|
||||||
or tabAccount.account_type = "Expense Account")
|
or tabAccount.account_type = "Expense Account")
|
||||||
and tabAccount.group_or_ledger="Ledger"
|
and tabAccount.group_or_ledger="Ledger"
|
||||||
and tabAccount.docstatus!=2
|
and tabAccount.docstatus!=2
|
||||||
|
and ifnull(tabAccount.master_type, "")=""
|
||||||
|
and ifnull(tabAccount.master_name, "")=""
|
||||||
and tabAccount.company = '%(company)s'
|
and tabAccount.company = '%(company)s'
|
||||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
||||||
|
@ -925,11 +925,16 @@ def get_bank_cash_account(mode_of_payment):
|
|||||||
def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
||||||
from controllers.queries import get_match_cond
|
from controllers.queries import get_match_cond
|
||||||
|
|
||||||
|
# income account can be any Credit account,
|
||||||
|
# but can also be a Asset account with account_type='Income Account' in special circumstances.
|
||||||
|
# Hence the first condition is an "OR"
|
||||||
return webnotes.conn.sql("""select tabAccount.name from `tabAccount`
|
return webnotes.conn.sql("""select tabAccount.name from `tabAccount`
|
||||||
where (tabAccount.debit_or_credit="Credit"
|
where (tabAccount.debit_or_credit="Credit"
|
||||||
or tabAccount.account_type = "Income Account")
|
or tabAccount.account_type = "Income Account")
|
||||||
and tabAccount.group_or_ledger="Ledger"
|
and tabAccount.group_or_ledger="Ledger"
|
||||||
and tabAccount.docstatus!=2
|
and tabAccount.docstatus!=2
|
||||||
|
and ifnull(tabAccount.master_type, "")=""
|
||||||
|
and ifnull(tabAccount.master_name, "")=""
|
||||||
and tabAccount.company = '%(company)s'
|
and tabAccount.company = '%(company)s'
|
||||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user