fix: check column in credit limit

This commit is contained in:
Mangesh-Khairnar 2019-08-31 13:16:14 +05:30
parent f856b3b559
commit e3bb247868
2 changed files with 7 additions and 4 deletions

View File

@ -17,10 +17,13 @@ def execute():
def move_credit_limit_to_child_table():
''' maps data from old field to the new field in the child table '''
if not frappe.db.has_column('Customer', 'bypass_credit_limit_check_at_sales_order'):
fields = ", bypass_credit_limit_check_at_sales_order"
credit_limit_data = frappe.db.sql(''' SELECT
name, credit_limit,
bypass_credit_limit_check_at_sales_order
FROM `tabCustomer`''', as_dict=1)
name, credit_limit
{0}
FROM `tabCustomer`'''.format(fields), as_dict=1) #nosec
companies = frappe.get_all("Company", 'name')

View File

@ -330,7 +330,7 @@ def get_credit_limit(customer, company):
credit_limit = frappe.db.get_value("Customer Credit Limit", {'parent': customer, 'company': company}, 'credit_limit')
if not credit_limit:
customer_group = frappe.db.get_value("Customer", customer, 'credit_group')
customer_group = frappe.db.get_value("Customer", customer, 'customer_group')
credit_limit = frappe.get_cached_value("Customer Group", customer_group, "credit_limit")
if not credit_limit: