fix: get credit limit

This commit is contained in:
Mangesh-Khairnar 2019-08-30 22:57:51 +05:30
parent b3e5d11e1d
commit 89433b4bea
2 changed files with 7 additions and 6 deletions

View File

@ -335,12 +335,13 @@ def get_credit_limit(customer, company):
c.name = %s
AND c.name = ccl.parent
AND ccl.company = %s
""", (customer, company), as_dict=1)
""", (customer, company))
credit_limit = credit_record.credit_limit
if credit_record:
customer_group, credit_limit = credit_record[0]
if not credit_limit:
credit_limit = frappe.get_cached_value("Customer Group", credit_record.customer_group, "credit_limit")
if not credit_limit and customer_group:
credit_limit = frappe.get_cached_value("Customer Group", customer_group, "credit_limit")
if not credit_limit:
credit_limit = frappe.get_cached_value('Company', company, "credit_limit")