fix: map old data as per new options of no-of-employees
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index c7dc27e..e5beacd 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -309,4 +309,5 @@
erpnext.patches.v14_0.crm_ux_cleanup
erpnext.patches.v14_0.remove_india_localisation # 14-07-2022
erpnext.patches.v13_0.fix_number_and_frequency_for_monthly_depreciation
-erpnext.patches.v14_0.remove_hr_and_payroll_modules # 20-07-2022
\ No newline at end of file
+erpnext.patches.v14_0.remove_hr_and_payroll_modules # 20-07-2022
+erpnext.patches.v14_0.fix_crm_no_of_employees
\ No newline at end of file
diff --git a/erpnext/patches/v14_0/fix_crm_no_of_employees.py b/erpnext/patches/v14_0/fix_crm_no_of_employees.py
new file mode 100644
index 0000000..268eb95
--- /dev/null
+++ b/erpnext/patches/v14_0/fix_crm_no_of_employees.py
@@ -0,0 +1,26 @@
+import frappe
+
+
+def execute():
+ options = {
+ "11-20": "11-50",
+ "21-30": "11-50",
+ "31-100": "51-200",
+ "101-500": "201-500",
+ "500-1000": "501-1000",
+ ">1000": "1000+",
+ }
+
+ for doctype in ("Lead", "Opportunity", "Prospect"):
+ frappe.reload_doctype(doctype)
+ for key, value in options.items():
+ frappe.db.sql(
+ """
+ update `tab{doctype}`
+ set no_of_employees = %s
+ where no_of_employees = %s
+ """.format(
+ doctype=doctype
+ ),
+ (value, key),
+ )