Reload pricing rule in patch
diff --git a/erpnext/patches/v4_0/set_pricing_rule_for_buying_or_selling.py b/erpnext/patches/v4_0/set_pricing_rule_for_buying_or_selling.py
index 218029d..8be846f 100644
--- a/erpnext/patches/v4_0/set_pricing_rule_for_buying_or_selling.py
+++ b/erpnext/patches/v4_0/set_pricing_rule_for_buying_or_selling.py
@@ -5,6 +5,7 @@
import frappe
def execute():
+ frappe.reload_doc("accounts", "doctype", "pricing_rule")
frappe.db.sql("""update `tabPricing Rule` set selling=1 where ifnull(applicable_for, '') in
('', 'Customer', 'Customer Group', 'Territory', 'Sales Partner', 'Campaign')""")