[fixes] added filters company and currency to get account, removed account name wise comparison

This commit is contained in:
Saurabh
2016-02-23 20:01:04 +05:30
parent f54be2c7f0
commit 4a6bbf9b72
2 changed files with 12 additions and 14 deletions

View File

@@ -479,15 +479,13 @@ def get_outstanding_invoices(party_type, party, account, condition=None):
return outstanding_invoices
def get_account(account_type=None, root_type=None, is_group=None, account_name=None):
def get_account(account_type=None, root_type=None, is_group=None, account_currency=None, company=None):
"""return account based on matching conditions"""
if account_name:
if not frappe.db.get_value("Account", {"account_name": account_name}):
return False
else:
return frappe.get_doc("Account", {
"account_type": account_type or '',
"root_type": root_type or '',
"is_group": is_group or 0,
"account_name": account_name or ''
})
return frappe.db.get_value("Account", {
"account_type": account_type or '',
"root_type": root_type or '',
"is_group": is_group or 0,
"account_currency": account_currency or frappe.defaults.get_defaults().currency,
"company": company or frappe.defaults.get_defaults().company
}, "name")