diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 8d7ca10a19..ca8b0ecb54 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -458,3 +458,4 @@ erpnext.patches.v9_0.copy_old_fees_field_data erpnext.patches.v9_0.set_pos_profile_name erpnext.patches.v9_0.remove_non_existing_warehouse_from_stock_settings execute:frappe.delete_doc_if_exists("DocType", "Program Fee") +erpnext.patches.v9_2.delete_healthcare_domain_default_items \ No newline at end of file diff --git a/erpnext/patches/v9_2/__init__.py b/erpnext/patches/v9_2/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/patches/v9_2/delete_healthcare_domain_default_items.py b/erpnext/patches/v9_2/delete_healthcare_domain_default_items.py new file mode 100644 index 0000000000..187cbd3f9a --- /dev/null +++ b/erpnext/patches/v9_2/delete_healthcare_domain_default_items.py @@ -0,0 +1,16 @@ +import frappe +from frappe.utils import getdate + +def execute(): + domain_settings = frappe.get_doc('Domain Settings') + active_domains = [d.domain for d in domain_settings.active_domains] + + if "Healthcare" not in active_domains: + items = ["TTT", "MCH", "LDL", "GTT", "HDL", "BILT", "BILD", "BP", "BS"] + for item_code in items: + try: + item = frappe.db.get_value("Item", {"item_code": item_code}, ["name", "creation"], as_dict=1) + if item and getdate(item.creation) >= getdate("2017-11-10"): + frappe.delete_doc("Item", item.name) + except: + pass \ No newline at end of file