fix: credit limit patch

This commit is contained in:
Nabin Hait 2019-09-05 16:57:26 +05:30
parent b847731482
commit ac2b5ed84f

View File

@ -21,10 +21,10 @@ def move_credit_limit_to_child_table():
if frappe.db.has_column('Customer', 'bypass_credit_limit_check_at_sales_order'): if frappe.db.has_column('Customer', 'bypass_credit_limit_check_at_sales_order'):
fields = ", bypass_credit_limit_check_at_sales_order" fields = ", bypass_credit_limit_check_at_sales_order"
credit_limit_record = frappe.db.sql(''' SELECT credit_limit_record = frappe.db.sql('''
name, credit_limit SELECT name, credit_limit {0}
{0} FROM `tabCustomer` where credit_limit > 0
FROM `tabCustomer`'''.format(fields), as_dict=1) #nosec '''.format(fields), as_dict=1) #nosec
companies = frappe.get_all("Company", 'name') companies = frappe.get_all("Company", 'name')
@ -36,4 +36,5 @@ def move_credit_limit_to_child_table():
'bypass_credit_limit_check': record.bypass_credit_limit_check_at_sales_order, 'bypass_credit_limit_check': record.bypass_credit_limit_check_at_sales_order,
'company': company.name 'company': company.name
}) })
customer.db_insert() for row in customer.credit_limit_reference:
row.db_insert()