Fix in Pricing Rule Patch
diff --git a/erpnext/patches/4_0/customer_discount_to_pricing_rule.py b/erpnext/patches/4_0/customer_discount_to_pricing_rule.py
index b310a1f..1566301 100644
--- a/erpnext/patches/4_0/customer_discount_to_pricing_rule.py
+++ b/erpnext/patches/4_0/customer_discount_to_pricing_rule.py
@@ -7,6 +7,8 @@
def execute():
frappe.reload_doc("accounts", "doctype", "pricing_rule")
+ frappe.db.auto_commit_on_many_writes = True
+
for d in frappe.db.sql("""select * from `tabCustomer Discount`
where ifnull(parent, '') != '' and docstatus < 2""", as_dict=1):
if not d.item_group:
@@ -24,6 +26,7 @@
"price_or_discount": "Discount",
"discount_percentage": d.discount
}]).insert()
-
+
+ frappe.db.auto_commit_on_many_writes = False
frappe.delete_doc("DocType", "Customer Discount")
\ No newline at end of file