From cce35c15360ca9a67bafb1c71ad4655312585cac Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Thu, 20 Jan 2022 19:42:08 +0530 Subject: [PATCH] fix(patch): delete hospitality custom fields (#29382) --- erpnext/patches.txt | 2 +- erpnext/patches/v14_0/delete_hospitality_doctypes.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 981500e1c7d..e21671c9c61 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -326,7 +326,7 @@ erpnext.patches.v14_0.set_payroll_cost_centers erpnext.patches.v13_0.agriculture_deprecation_warning erpnext.patches.v14_0.delete_agriculture_doctypes erpnext.patches.v13_0.hospitality_deprecation_warning -erpnext.patches.v14_0.delete_hospitality_doctypes +erpnext.patches.v14_0.delete_hospitality_doctypes # 20-01-2022 erpnext.patches.v13_0.update_exchange_rate_settings erpnext.patches.v14_0.rearrange_company_fields erpnext.patches.v14_0.update_leave_notification_template diff --git a/erpnext/patches/v14_0/delete_hospitality_doctypes.py b/erpnext/patches/v14_0/delete_hospitality_doctypes.py index 5bb5e4bb893..d0216f80d3d 100644 --- a/erpnext/patches/v14_0/delete_hospitality_doctypes.py +++ b/erpnext/patches/v14_0/delete_hospitality_doctypes.py @@ -20,3 +20,13 @@ def execute(): doctypes = frappe.get_all("DocType", {"module": module, "custom": 0}, pluck='name') for doctype in doctypes: frappe.delete_doc("DocType", doctype, ignore_missing=True) + + custom_fields = [ + {"dt": "Sales Invoice", "fieldname": "restaurant"}, + {"dt": "Sales Invoice", "fieldname": "restaurant_table"}, + {"dt": "Price List", "fieldname": "restaurant_menu"}, + ] + + for field in custom_fields: + custom_field = frappe.db.get_value("Custom Field", field) + frappe.delete_doc("Custom Field", custom_field, ignore_missing=True)