From 5d2e52c4effbeaa4769132ae8c48f31c33746942 Mon Sep 17 00:00:00 2001 From: Ranjith Date: Mon, 19 Nov 2018 20:03:25 +0530 Subject: [PATCH] fix: healthcare patch --- .../v11_0/add_healthcare_service_unit_tree_root.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v11_0/add_healthcare_service_unit_tree_root.py b/erpnext/patches/v11_0/add_healthcare_service_unit_tree_root.py index 0c4209ac9a..029ea8738b 100644 --- a/erpnext/patches/v11_0/add_healthcare_service_unit_tree_root.py +++ b/erpnext/patches/v11_0/add_healthcare_service_unit_tree_root.py @@ -3,12 +3,18 @@ from frappe import _ def execute(): """ assign lft and rgt appropriately """ + if "Healthcare" not in frappe.get_active_domains(): + return + frappe.reload_doc("healthcare", "doctype", "healthcare_service_unit") frappe.reload_doc("healthcare", "doctype", "healthcare_service_unit_type") + company = frappe.get_value("Company", {"domain": "Healthcare"}, "name") - if not frappe.db.exists("Healthcare Service Unit", _('All Healthcare Service Units')): + if company: frappe.get_doc({ 'doctype': 'Healthcare Service Unit', 'healthcare_service_unit_name': _('All Healthcare Service Units'), - 'is_group': 1 + 'is_group': 1, + 'company': company }).insert(ignore_permissions=True) +