Healthcare Settings - Heathcare Service Item - Validation
diff --git a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.js b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.js
index 8879d93..22fbf50 100644
--- a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.js
+++ b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.js
@@ -25,6 +25,7 @@
});
set_query_service_item(frm, 'inpatient_visit_charge_item');
set_query_service_item(frm, 'op_consulting_charge_item');
+ set_query_service_item(frm, 'clinical_procedure_consumable_item');
}
});
@@ -37,4 +38,4 @@
}
};
});
-}
+};
diff --git a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py
index 8c3cdfe..8555e80 100644
--- a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py
+++ b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py
@@ -10,13 +10,19 @@
import json
class HealthcareSettings(Document):
- def validate(self):
- for key in ["collect_registration_fee","manage_customer","patient_master_name",
- "require_test_result_approval","require_sample_collection", "default_medical_code_standard"]:
- frappe.db.set_default(key, self.get(key, ""))
- if(self.collect_registration_fee):
- if self.registration_fee <= 0 :
- frappe.throw(_("Registration fee can not be Zero"))
+ def validate(self):
+ for key in ["collect_registration_fee","manage_customer","patient_master_name",
+ "require_test_result_approval","require_sample_collection", "default_medical_code_standard"]:
+ frappe.db.set_default(key, self.get(key, ""))
+ if(self.collect_registration_fee):
+ if self.registration_fee <= 0 :
+ frappe.throw(_("Registration fee can not be Zero"))
+ if self.inpatient_visit_charge_item:
+ validate_service_item(self.inpatient_visit_charge_item, "Configure a service Item for Inpatient Visit Charge Item")
+ if self.op_consulting_charge_item:
+ validate_service_item(self.op_consulting_charge_item, "Configure a service Item for Out Patient Consulting Charge Item")
+ if self.clinical_procedure_consumable_item:
+ validate_service_item(self.clinical_procedure_consumable_item, "Configure a service Item for Clinical Procedure Consumable Item")
@frappe.whitelist()
def get_sms_text(doc):
@@ -67,3 +73,7 @@
if(parent_field):
return frappe.db.get_value("Party Account",
{"parentfield": parent_field, "parent": parent, "company": company}, "account")
+
+def validate_service_item(item, msg):
+ if frappe.db.get_value("Item", item, "is_stock_item") == 1:
+ frappe.throw(_(msg))