mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 23:52:57 +00:00
fix: get credit limit
This commit is contained in:
@@ -18,8 +18,8 @@ def move_credit_limit_to_child_table():
|
|||||||
''' maps data from old field to the new field in the child table '''
|
''' maps data from old field to the new field in the child table '''
|
||||||
|
|
||||||
credit_limit_data = frappe.db.sql(''' SELECT
|
credit_limit_data = frappe.db.sql(''' SELECT
|
||||||
name, credit_limit,
|
name, credit_limit,
|
||||||
bypass_credit_limit_check_at_sales_order
|
bypass_credit_limit_check_at_sales_order
|
||||||
FROM `tabCustomer`''', as_dict=1)
|
FROM `tabCustomer`''', as_dict=1)
|
||||||
|
|
||||||
companies = frappe.get_all("Company", 'name')
|
companies = frappe.get_all("Company", 'name')
|
||||||
|
|||||||
@@ -335,12 +335,13 @@ def get_credit_limit(customer, company):
|
|||||||
c.name = %s
|
c.name = %s
|
||||||
AND c.name = ccl.parent
|
AND c.name = ccl.parent
|
||||||
AND ccl.company = %s
|
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:
|
if not credit_limit and customer_group:
|
||||||
credit_limit = frappe.get_cached_value("Customer Group", credit_record.customer_group, "credit_limit")
|
credit_limit = frappe.get_cached_value("Customer Group", customer_group, "credit_limit")
|
||||||
|
|
||||||
if not credit_limit:
|
if not credit_limit:
|
||||||
credit_limit = frappe.get_cached_value('Company', company, "credit_limit")
|
credit_limit = frappe.get_cached_value('Company', company, "credit_limit")
|
||||||
|
|||||||
Reference in New Issue
Block a user