fix: show Change Item Code button only if Unit Type is billable
diff --git a/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.json b/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.json
index 67712c9..9860a21 100644
--- a/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.json
+++ b/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.json
@@ -38,13 +38,13 @@
"column_break_18",
"inpatient_visit_charge_item",
"inpatient_visit_charge",
+ "account_details",
+ "default_currency",
+ "accounts",
"address_and_contacts_section",
"address_html",
"column_break_19",
- "contact_html",
- "account_details",
- "accounts",
- "default_currency"
+ "contact_html"
],
"fields": [
{
@@ -277,7 +277,7 @@
],
"image_field": "image",
"links": [],
- "modified": "2020-03-20 15:13:13.382212",
+ "modified": "2020-03-24 17:25:55.128808",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Healthcare Practitioner",
diff --git a/erpnext/healthcare/doctype/healthcare_service_unit_type/healthcare_service_unit_type.js b/erpnext/healthcare/doctype/healthcare_service_unit_type/healthcare_service_unit_type.js
index f5e8a6f..eb33ab6 100644
--- a/erpnext/healthcare/doctype/healthcare_service_unit_type/healthcare_service_unit_type.js
+++ b/erpnext/healthcare/doctype/healthcare_service_unit_type/healthcare_service_unit_type.js
@@ -4,7 +4,7 @@
frappe.ui.form.on('Healthcare Service Unit Type', {
refresh: function(frm) {
frm.set_df_property('item_code', 'read_only', frm.doc.__islocal ? 0 : 1);
- if (!frm.doc.__islocal) {
+ if (!frm.doc.__islocal && frm.doc.is_billable) {
frm.add_custom_button(__('Change Item Code'), function() {
change_item_code(cur_frm, frm.doc);
});
@@ -59,7 +59,8 @@
'fieldtype': 'Data',
'label': 'Item Code',
'fieldname': 'item_code',
- reqd: 1
+ 'default': doc.item_code,
+ reqd: 1,
}
],
primary_action: function() {
diff --git a/erpnext/healthcare/doctype/patient/patient.py b/erpnext/healthcare/doctype/patient/patient.py
index d03a131..fc63b19 100644
--- a/erpnext/healthcare/doctype/patient/patient.py
+++ b/erpnext/healthcare/doctype/patient/patient.py
@@ -53,6 +53,7 @@
set_name_by_naming_series(self)
def get_patient_name(self):
+ self.set_full_name()
name = self.patient_name
if frappe.db.get_value('Patient', name):
count = frappe.db.sql("""select ifnull(MAX(CAST(SUBSTRING_INDEX(name, ' ', -1) AS UNSIGNED)), 0) from tabPatient