[fixes] return debtors account name
This commit is contained in:
parent
d61b21cedf
commit
b43df36e85
@ -479,7 +479,7 @@ def get_outstanding_invoices(party_type, party, account, condition=None):
|
|||||||
return outstanding_invoices
|
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 account based on matching conditions"""
|
||||||
return frappe.db.get_value("Account", {
|
return frappe.db.get_value("Account", {
|
||||||
"account_type": account_type or '',
|
"account_type": account_type or '',
|
||||||
|
@ -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.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 erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import get_shopping_cart_settings
|
||||||
from frappe.utils.nestedset import get_root_of
|
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
|
class WebsitePriceListMissingError(frappe.ValidationError): pass
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ def get_customer(user=None):
|
|||||||
customer.update({
|
customer.update({
|
||||||
"accounts": [{
|
"accounts": [{
|
||||||
"company": cart_settings.company,
|
"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))
|
account_name = _("Debtors ({0})".format(payment_gateway_account_currency))
|
||||||
|
|
||||||
debtors_account = get_account("Receivable", "Asset", is_group=0,\
|
debtors_account_name = get_account_name("Receivable", "Asset", is_group=0,\
|
||||||
account_currency=payment_gateway_account_currency, company=cart_settings.company)
|
account_currency=payment_gateway_account_currency, company=cart_settings.company)
|
||||||
|
|
||||||
if not debtors_account:
|
if not debtors_account_name:
|
||||||
debtors_account = frappe.get_doc({
|
debtors_account = frappe.get_doc({
|
||||||
"doctype": "Account",
|
"doctype": "Account",
|
||||||
"account_type": "Receivable",
|
"account_type": "Receivable",
|
||||||
"root_type": "Asset",
|
"root_type": "Asset",
|
||||||
"is_group": 0,
|
"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,
|
"account_name": account_name,
|
||||||
"currency": payment_gateway_account_currency
|
"currency": payment_gateway_account_currency
|
||||||
}).insert(ignore_permissions=True)
|
}).insert(ignore_permissions=True)
|
||||||
|
|
||||||
return debtors_account
|
return debtors_account.name
|
||||||
|
|
||||||
else:
|
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):
|
def get_address_docs(doctype=None, txt=None, filters=None, limit_start=0, limit_page_length=20, party=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user