diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 0c909bfa1b..2af12698c5 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -632,4 +632,4 @@ execute:frappe.reload_doc('desk', 'doctype','dashboard_chart') erpnext.patches.v12_0.add_default_dashboards erpnext.patches.v12_0.remove_bank_remittance_custom_fields erpnext.patches.v12_0.generate_leave_ledger_entries -erpnext.patches.v12_0.move_credit_limit_to_customer_credit_limit # \ No newline at end of file +erpnext.patches.v12_0.move_credit_limit_to_customer_credit_limit \ No newline at end of file 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 0b3da20986..6f59b46ee7 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 @@ -21,19 +21,19 @@ def move_credit_limit_to_child_table(): if 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 + credit_limit_record = frappe.db.sql(''' SELECT name, credit_limit {0} FROM `tabCustomer`'''.format(fields), as_dict=1) #nosec companies = frappe.get_all("Company", 'name') - for customer in credit_limit_data: + for record in credit_limit_record: customer = frappe.get_doc("Customer", customer.name) for company in companies: customer.append("credit_limit_reference", { - 'credit_limit': customer.credit_limit, - 'bypass_credit_limit_check': customer.bypass_credit_limit_check_at_sales_order, + 'credit_limit': record.credit_limit, + 'bypass_credit_limit_check': record.bypass_credit_limit_check_at_sales_order, 'company': company.name }) customer.save() \ No newline at end of file