fix: bypass credit limit check

This commit is contained in:
Mangesh-Khairnar 2019-09-01 10:15:23 +05:30
parent bb3cec1556
commit 86720deeae
2 changed files with 5 additions and 5 deletions

View File

@ -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 #
erpnext.patches.v12_0.move_credit_limit_to_customer_credit_limit

View File

@ -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()