From b43df36e851252a258f53d2eddbe6d802cc3712b Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 18 Mar 2016 15:05:50 +0530 Subject: [PATCH] [fixes] return debtors account name --- erpnext/accounts/utils.py | 2 +- erpnext/shopping_cart/cart.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 5678c29981c..06197eb61fc 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -479,7 +479,7 @@ 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_currency=None, company=None): +def get_account_name(account_type=None, root_type=None, is_group=None, account_currency=None, company=None): """return account based on matching conditions""" return frappe.db.get_value("Account", { "account_type": account_type or '', diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index 012aaf7750a..27271afadd0 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -9,7 +9,7 @@ from frappe.utils import cint, flt, get_fullname, cstr from erpnext.utilities.doctype.address.address import get_address_display from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import get_shopping_cart_settings from frappe.utils.nestedset import get_root_of -from erpnext.accounts.utils import get_account +from erpnext.accounts.utils import get_account_name class WebsitePriceListMissingError(frappe.ValidationError): pass @@ -305,7 +305,7 @@ def get_customer(user=None): customer.update({ "accounts": [{ "company": cart_settings.company, - "account": debtors_account.name + "account": debtors_account }] }) @@ -329,24 +329,24 @@ def get_debtors_account(cart_settings): account_name = _("Debtors ({0})".format(payment_gateway_account_currency)) - debtors_account = get_account("Receivable", "Asset", is_group=0,\ - account_currency=payment_gateway_account_currency, company=cart_settings.company) + debtors_account_name = get_account_name("Receivable", "Asset", is_group=0,\ + account_currency=payment_gateway_account_currency, company=cart_settings.company) - if not debtors_account: + if not debtors_account_name: debtors_account = frappe.get_doc({ "doctype": "Account", "account_type": "Receivable", "root_type": "Asset", "is_group": 0, - "parent_account": get_account(root_type="Asset", is_group=1, company=cart_settings.company), + "parent_account": get_account_name(root_type="Asset", is_group=1, company=cart_settings.company), "account_name": account_name, "currency": payment_gateway_account_currency }).insert(ignore_permissions=True) - return debtors_account + return debtors_account.name else: - return debtors_account + return debtors_account_name def get_address_docs(doctype=None, txt=None, filters=None, limit_start=0, limit_page_length=20, party=None):