fix: check column in credit limit
diff --git a/erpnext/patches/v12_0/move_credit_limit_to_customer_credit_limit.py b/erpnext/patches/v12_0/move_credit_limit_to_customer_credit_limit.py
index 344dd82..58ad337 100644
--- a/erpnext/patches/v12_0/move_credit_limit_to_customer_credit_limit.py
+++ b/erpnext/patches/v12_0/move_credit_limit_to_customer_credit_limit.py
@@ -17,10 +17,13 @@
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')
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index 0ecb41e..3d5fee9 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -330,7 +330,7 @@
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: