From c7417c08ed51e4570df57fd59dd17b76cd304d07 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Tue, 28 Jan 2020 18:06:23 +0530 Subject: [PATCH] refactor: Healthcare Settings --- .../healthcare_settings.json | 103 ++++++++-------- .../healthcare_settings.py | 111 ++++++++++-------- .../healthcare/doctype/lab_test/lab_test.js | 2 +- .../healthcare/doctype/lab_test/lab_test.py | 2 +- erpnext/healthcare/doctype/patient/patient.py | 2 +- .../sample_collection/sample_collection.js | 2 +- .../lab_test_print/lab_test_print.json | 38 +++--- erpnext/healthcare/utils.py | 2 +- 8 files changed, 136 insertions(+), 126 deletions(-) diff --git a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json index 95d9e44cdd..5e391968ba 100644 --- a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json +++ b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json @@ -8,7 +8,7 @@ "field_order": [ "sb_op_settings", "patient_master_name", - "manage_customer", + "link_customer_to_patient", "default_medical_code_standard", "column_break_9", "collect_registration_fee", @@ -21,9 +21,19 @@ "op_consulting_charge_item", "column_break_13", "clinical_procedure_consumable_item", + "sb_in_ac", + "income_account", + "receivable_account", + "sb_lab_settings", + "create_lab_test_on_si_submit", + "create_sample_collection_for_lab_test", + "column_break_34", + "employee_name_and_designation_in_print", + "lab_test_approval_required", + "custom_signature_in_print", "out_patient_sms_alerts", - "reg_sms", "reg_msg", + "reg_sms", "app_con", "app_con_msg", "no_con", @@ -31,17 +41,6 @@ "app_rem", "app_rem_msg", "rem_before", - "sb_in_ac", - "income_account", - "sb_r_ac", - "receivable_account", - "sb_lab_settings", - "create_test_on_si_submit", - "require_sample_collection", - "require_test_result_approval", - "column_break_34", - "employee_name_and_designation_in_print", - "custom_signature_in_print", "laboratory_sms_alerts", "sms_printed", "column_break_28", @@ -59,13 +58,6 @@ "label": "Patient Name By", "options": "Patient Name\nNaming Series" }, - { - "default": "1", - "description": "If checked, a customer will be created, mapped to Patient.\nPatient Invoices will be created against this Customer. You can also select existing Customer while creating Patient.", - "fieldname": "manage_customer", - "fieldtype": "Check", - "label": "Manage Customer" - }, { "fieldname": "default_medical_code_standard", "fieldtype": "Link", @@ -98,20 +90,23 @@ "label": "Invoice Appointments Automatically" }, { + "description": "The number of free follow ups (Patient Encounters in valid days) allowed", "fieldname": "max_visit", "fieldtype": "Int", "label": "Patient Encounters in valid days" }, { + "description": "Time period (Valid number of days) for free consultations", "fieldname": "valid_days", "fieldtype": "Int", "label": "Valid number of days" }, { "collapsible": 1, + "description": "You can configure default Items for billing consultation charges, procedure consumption items and inpatient visits", "fieldname": "healthcare_service_items", "fieldtype": "Section Break", - "label": "Healthcare Service Items" + "label": "Default Healthcare Service Items" }, { "fieldname": "inpatient_visit_charge_item", @@ -203,25 +198,19 @@ }, { "collapsible": 1, - "description": "Default income accounts to be used if not set in Healthcare Practitioner to book Appointment charges.", "fieldname": "sb_in_ac", "fieldtype": "Section Break", - "label": "Income Account" + "label": "Default Accounts" }, { + "description": "Default income accounts to be used if not set in Healthcare Practitioner to book Appointment charges.", "fieldname": "income_account", "fieldtype": "Table", "label": "Income Account", "options": "Party Account" }, { - "collapsible": 1, - "description": "Default receivable accounts to be used if not set in Patient to book Appointment charges.", - "fieldname": "sb_r_ac", - "fieldtype": "Section Break", - "label": "Receivable Account" - }, - { + "description": "Default receivable accounts to be used to book Appointment charges.", "fieldname": "receivable_account", "fieldtype": "Table", "label": "Receivable Account", @@ -233,31 +222,13 @@ "fieldtype": "Section Break", "label": "Laboratory Settings" }, - { - "default": "0", - "fieldname": "create_test_on_si_submit", - "fieldtype": "Check", - "label": "Create Lab Test(s) on Sales Invoice Submit" - }, - { - "default": "0", - "description": "Create documents for sample collection", - "fieldname": "require_sample_collection", - "fieldtype": "Check", - "label": "Manage Sample Collection" - }, - { - "default": "0", - "fieldname": "require_test_result_approval", - "fieldtype": "Check", - "label": "Require Lab Test Approval" - }, { "fieldname": "column_break_34", "fieldtype": "Column Break" }, { "default": "1", + "description": "Check this if you want the Name and Designation of the Employee associated with the User who submits the document to be printed in the Lab Test Report.", "fieldname": "employee_name_and_designation_in_print", "fieldtype": "Check", "label": "Employee name and designation in print" @@ -279,7 +250,7 @@ "fieldname": "sms_printed", "fieldtype": "Small Text", "ignore_xss_filter": 1, - "label": "Result Printed" + "label": "Result Printed Message" }, { "fieldname": "column_break_28", @@ -290,12 +261,40 @@ "fieldname": "sms_emailed", "fieldtype": "Small Text", "ignore_xss_filter": 1, - "label": "Result Emailed" + "label": "Result Emailed Message" + }, + { + "default": "0", + "description": "Checking this will restrict printing and emailing of Lab Test documents unless they have the status as Approved.", + "fieldname": "lab_test_approval_required", + "fieldtype": "Check", + "label": "Do not print or email Lab Tests without Approval" + }, + { + "default": "1", + "description": "If checked, a customer will be created, mapped to Patient.\nPatient Invoices will be created against this Customer. You can also select existing Customer while creating Patient.", + "fieldname": "link_customer_to_patient", + "fieldtype": "Check", + "label": "Link Customer to Patient" + }, + { + "default": "0", + "description": "Checking this will create Lab Test(s) specified in the Sales Invoice on submission.", + "fieldname": "create_lab_test_on_si_submit", + "fieldtype": "Check", + "label": "Create Lab Test(s) on Sales Invoice Submission" + }, + { + "default": "0", + "description": "Checking this will create a Sample Collection document every time you create a Lab Test", + "fieldname": "create_sample_collection_for_lab_test", + "fieldtype": "Check", + "label": "Create Sample Collection document for Lab Test" } ], "issingle": 1, "links": [], - "modified": "2020-01-23 13:31:43.699711", + "modified": "2020-01-28 18:04:48.671093", "modified_by": "Administrator", "module": "Healthcare", "name": "Healthcare Settings", diff --git a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py index 8555e80f84..a36bed6b24 100644 --- a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py +++ b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py @@ -11,69 +11,80 @@ 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"]: + for key in ['collect_registration_fee', 'link_customer_to_patient', 'patient_master_name', + 'lab_test_approval_required', 'create_sample_collection_for_lab_test', '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.collect_registration_fee: + if self.registration_fee <= 0: + frappe.throw(_('Registration Fee cannot be negative or zero')) + if self.inpatient_visit_charge_item: - validate_service_item(self.inpatient_visit_charge_item, "Configure a service Item for Inpatient Visit Charge Item") + validate_service_item(self.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") + validate_service_item(self.op_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") + validate_service_item(self.clinical_procedure_consumable_item) + + +def validate_service_item(item): + if frappe.db.get_value('Item', item, 'is_stock_item'): + frappe.throw(_('Configure a service Item for {0}').format(item)) @frappe.whitelist() def get_sms_text(doc): - sms_text = {} - doc = frappe.get_doc("Lab Test",doc) - #doc = json.loads(doc) - context = {"doc": doc, "alert": doc, "comments": None} - emailed = frappe.db.get_value("Healthcare Settings", None, "sms_emailed") - sms_text['emailed'] = frappe.render_template(emailed, context) - printed = frappe.db.get_value("Healthcare Settings", None, "sms_printed") - sms_text['printed'] = frappe.render_template(printed, context) - return sms_text + sms_text = {} + doc = frappe.get_doc('Lab Test', doc) + context = {'doc': doc, 'alert': doc, 'comments': None} + + emailed = frappe.db.get_value('Healthcare Settings', None, 'sms_emailed') + sms_text['emailed'] = frappe.render_template(emailed, context) + + printed = frappe.db.get_value('Healthcare Settings', None, 'sms_printed') + sms_text['printed'] = frappe.render_template(printed, context) + + return sms_text def send_registration_sms(doc): - if (frappe.db.get_value("Healthcare Settings", None, "reg_sms")=='1'): - if doc.mobile: - context = {"doc": doc, "alert": doc, "comments": None} - if doc.get("_comments"): - context["comments"] = json.loads(doc.get("_comments")) - messages = frappe.db.get_value("Healthcare Settings", None, "reg_msg") - messages = frappe.render_template(messages, context) - number = [doc.mobile] - send_sms(number,messages) - else: - frappe.msgprint(doc.name + " Has no mobile number to send registration SMS", alert=True) - + if frappe.db.get_value('Healthcare Settings', None, 'reg_sms'): + if doc.mobile: + context = {'doc': doc, 'alert': doc, 'comments': None} + if doc.get('_comments'): + context['comments'] = json.loads(doc.get('_comments')) + messages = frappe.db.get_value('Healthcare Settings', None, 'reg_msg') + messages = frappe.render_template(messages, context) + number = [doc.mobile] + send_sms(number,messages) + else: + frappe.msgprint(doc.name + ' has no mobile number to send registration SMS', alert=True) def get_receivable_account(company): - receivable_account = get_account(None, "receivable_account", "Healthcare Settings", company) - if receivable_account: - return receivable_account - return frappe.get_cached_value('Company', company, "default_receivable_account") + receivable_account = get_account(None, 'receivable_account', 'Healthcare Settings', company) + if receivable_account: + return receivable_account + + return frappe.get_cached_value('Company', company, 'default_receivable_account') def get_income_account(practitioner, company): - if(practitioner): - income_account = get_account("Healthcare Practitioner", None, practitioner, company) - if income_account: - return income_account - income_account = get_account(None, "income_account", "Healthcare Settings", company) - if income_account: - return income_account - return frappe.get_cached_value('Company', company, "default_income_account") + # check income account in Healthcare Practitioner + if practitioner: + income_account = get_account('Healthcare Practitioner', None, practitioner, company) + if income_account: + return income_account + + # else check income account in Healthcare Settings + income_account = get_account(None, 'income_account', 'Healthcare Settings', company) + if income_account: + return income_account + + # else return default income account of company + return frappe.get_cached_value('Company', company, 'default_income_account') def get_account(parent_type, parent_field, parent, company): - if(parent_type): - return frappe.db.get_value("Party Account", - {"parenttype": parent_type, "parent": parent, "company": company}, "account") - if(parent_field): - return frappe.db.get_value("Party Account", - {"parentfield": parent_field, "parent": parent, "company": company}, "account") + if parent_type: + return frappe.db.get_value('Party Account', + {'parenttype': parent_type, '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)) + if parent_field: + return frappe.db.get_value('Party Account', + {'parentfield': parent_field, 'parent': parent, 'company': company}, 'account') diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.js b/erpnext/healthcare/doctype/lab_test/lab_test.js index b60e70fd76..5b3f4c705a 100644 --- a/erpnext/healthcare/doctype/lab_test/lab_test.js +++ b/erpnext/healthcare/doctype/lab_test/lab_test.js @@ -29,7 +29,7 @@ frappe.ui.form.on('Lab Test', { get_lab_test_prescribed(frm); }); } - if(frm.doc.docstatus==1 && frm.doc.status!='Approved' && frm.doc.status!='Rejected' && frappe.defaults.get_default("require_test_result_approval") && frappe.user.has_role("LabTest Approver")){ + if(frm.doc.docstatus==1 && frm.doc.status!='Approved' && frm.doc.status!='Rejected' && frappe.defaults.get_default("lab_test_approval_required") && frappe.user.has_role("LabTest Approver")){ frm.add_custom_button(__('Approve'), function() { status_update(1,frm); }); diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.py b/erpnext/healthcare/doctype/lab_test/lab_test.py index 8609489615..1a05f1e5a1 100644 --- a/erpnext/healthcare/doctype/lab_test/lab_test.py +++ b/erpnext/healthcare/doctype/lab_test/lab_test.py @@ -224,7 +224,7 @@ def create_sample_doc(template, patient, invoice): return sample_collection def create_sample_collection(lab_test, template, patient, invoice): - if(frappe.db.get_value("Healthcare Settings", None, "require_sample_collection") == "1"): + if(frappe.db.get_value("Healthcare Settings", None, "create_sample_collection_for_lab_test") == "1"): sample_collection = create_sample_doc(template, patient, invoice) if(sample_collection): lab_test.sample = sample_collection.name diff --git a/erpnext/healthcare/doctype/patient/patient.py b/erpnext/healthcare/doctype/patient/patient.py index e3eea96f85..df75c011cc 100644 --- a/erpnext/healthcare/doctype/patient/patient.py +++ b/erpnext/healthcare/doctype/patient/patient.py @@ -13,7 +13,7 @@ from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import g class Patient(Document): def after_insert(self): - if(frappe.db.get_value("Healthcare Settings", None, "manage_customer") == '1' and not self.customer): + if(frappe.db.get_value("Healthcare Settings", None, "link_customer_to_patient") == '1' and not self.customer): create_customer(self) if(frappe.db.get_value("Healthcare Settings", None, "collect_registration_fee") == '1'): frappe.db.set_value("Patient", self.name, "disabled", 1) diff --git a/erpnext/healthcare/doctype/sample_collection/sample_collection.js b/erpnext/healthcare/doctype/sample_collection/sample_collection.js index 9934ce4845..2f5278b2d5 100644 --- a/erpnext/healthcare/doctype/sample_collection/sample_collection.js +++ b/erpnext/healthcare/doctype/sample_collection/sample_collection.js @@ -3,7 +3,7 @@ frappe.ui.form.on('Sample Collection', { refresh: function(frm) { - if(frappe.defaults.get_default("require_sample_collection")){ + if(frappe.defaults.get_default("create_sample_collection_for_lab_test")){ frm.add_custom_button(__("View Lab Tests"), function() { frappe.route_options = {"sample": frm.doc.name}; frappe.set_route("List", "Lab Test"); diff --git a/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json b/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json index 6badc6f82d..e8e95d8439 100644 --- a/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json +++ b/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json @@ -1,22 +1,22 @@ { - "align_labels_right": 0, - "creation": "2017-04-24 15:38:45.332473", - "custom_format": 1, - "disabled": 0, - "doc_type": "Lab Test", - "docstatus": 0, - "doctype": "Print Format", - "font": "Default", - "html": "
\n {% if letter_head and not no_letterhead -%}\n
{{ letter_head }}
\n
\n {%- endif %}\n\n {% if (doc.docstatus != 1) %}\n Lab Tests have to be Submitted for Print .. !\n {% elif (frappe.db.get_value(\"Healthcare Settings\", \"None\", \"require_test_result_approval\") == '1' and doc.approval_status != \"Approved\") %}\n Lab Tests have to be Approved for Print .. !\n {%- else -%}\n
\n
\n\n
\n
\n \n
\n {% if doc.patient %}\n
\n : {{doc.patient}}\n
\n {% else %}\n
\n : Patient Name\n
\n {%- endif -%}\n
\n\n
\n
\n \n
\n
\n : {{doc.patient_age}}\n
\n
\n\n
\n
\n \n
\n
\n : {{doc.patient_sex}}\n
\n
\n\n
\n\n
\n\n
\n
\n \n
\n {% if doc.practitioner %}\n
\n : {{doc.practitioner}}\n
\n {%- endif -%}\n
\n\n {% if doc.sample_date %}\n
\n
\n \n
\n
\n : {{doc.sample_date}}\n
\n
\n {%- endif -%}\n\n {% if doc.result_date %}\n
\n
\n \n
\n
\n : {{doc.result_date}}\n
\n
\n {%- endif -%}\n\n
\n\n
\n\n
\n

Department of {{doc.department}}

\n
\n\n \n \n {%- if doc.normal_test_items -%}\n \n \n \n \n \n\n {%- if doc.normal_test_items|length > 1 %}\n \n {%- endif -%}\n\n {%- for row in doc.normal_test_items -%}\n \n \n\n \n\n \n \n\n {%- endfor -%}\n {%- endif -%}\n \n
Name of TestResultNormal Range
{{ doc.lab_test_name }}
\n {%- if doc.normal_test_items|length > 1 %}  {%- endif -%}\n {%- if row.lab_test_name -%}{{ row.lab_test_name }}\n {%- else -%}   {%- endif -%}\n {%- if row.lab_test_event -%}   {{ row.lab_test_event }}{%- endif -%}\n \n {%- if row.result_value -%}{{ row.result_value }}{%- endif -%} \n {%- if row.lab_test_uom -%}{{ row.lab_test_uom }}{%- endif -%}\n \n
\n {%- if row.normal_range -%}{{ row.normal_range }}{%- endif -%}\n
\n
\n\n \n \n {%- if doc.special_test_items -%}\n \n \n \n \n \n {%- for row in doc.special_test_items -%}\n \n \n \n \n\n {%- endfor -%}\n {%- endif -%}\n\n {%- if doc.sensitivity_test_items -%}\n \n \n \n \n {%- for row in doc.sensitivity_test_items -%}\n \n \n \n \n\n {%- endfor -%}\n {%- endif -%}\n\n \n
Name of TestResult
{{ doc.lab_test_name }}
  {{ row.lab_test_particulars }} \n {%- if row.result_value -%}{{ row.result_value }}{%- endif -%}\n
AntibioticSensitivity
{{ row.antibiotic }} {{ row.antibiotic_sensitivity }}
\n {%- endif -%}\n\n
\n {%- if (frappe.db.get_value(\"Healthcare Settings\", \"None\", \"employee_name_and_designation_in_print\") == '1') -%}\n
{{doc.employee_name}}
\n
{{doc.employee_designation}}
\n {%- else -%}\n
{{frappe.db.get_value(\"Healthcare Settings\", \"None\", \"custom_signature_in_print\") }}
\n {%- endif -%}\n
\n
\n", - "idx": 0, - "line_breaks": 0, - "modified": "2018-09-04 12:03:47.066918", - "modified_by": "Administrator", - "module": "Healthcare", - "name": "Lab Test Print", - "owner": "Administrator", - "print_format_builder": 0, - "print_format_type": "Server", - "show_section_headings": 0, + "align_labels_right": 0, + "creation": "2017-04-24 15:38:45.332473", + "custom_format": 1, + "disabled": 0, + "doc_type": "Lab Test", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "html": "
\n {% if letter_head and not no_letterhead -%}\n
{{ letter_head }}
\n
\n {%- endif %}\n\n {% if (doc.docstatus != 1) %}\n Lab Tests have to be Submitted for Print .. !\n {% elif (frappe.db.get_value(\"Healthcare Settings\", \"None\", \"lab_test_approval_required\") == '1' and doc.approval_status != \"Approved\") %}\n Lab Tests have to be Approved for Print .. !\n {%- else -%}\n
\n
\n\n
\n
\n \n
\n {% if doc.patient %}\n
\n : {{doc.patient}}\n
\n {% else %}\n
\n : Patient Name\n
\n {%- endif -%}\n
\n\n
\n
\n \n
\n
\n : {{doc.patient_age}}\n
\n
\n\n
\n
\n \n
\n
\n : {{doc.patient_sex}}\n
\n
\n\n
\n\n
\n\n
\n
\n \n
\n {% if doc.practitioner %}\n
\n : {{doc.practitioner}}\n
\n {%- endif -%}\n
\n\n {% if doc.sample_date %}\n
\n
\n \n
\n
\n : {{doc.sample_date}}\n
\n
\n {%- endif -%}\n\n {% if doc.result_date %}\n
\n
\n \n
\n
\n : {{doc.result_date}}\n
\n
\n {%- endif -%}\n\n
\n\n
\n\n
\n

Department of {{doc.department}}

\n
\n\n \n \n {%- if doc.normal_test_items -%}\n \n \n \n \n \n\n {%- if doc.normal_test_items|length > 1 %}\n \n {%- endif -%}\n\n {%- for row in doc.normal_test_items -%}\n \n \n\n \n\n \n \n\n {%- endfor -%}\n {%- endif -%}\n \n
Name of TestResultNormal Range
{{ doc.lab_test_name }}
\n {%- if doc.normal_test_items|length > 1 %}  {%- endif -%}\n {%- if row.lab_test_name -%}{{ row.lab_test_name }}\n {%- else -%}   {%- endif -%}\n {%- if row.lab_test_event -%}   {{ row.lab_test_event }}{%- endif -%}\n \n {%- if row.result_value -%}{{ row.result_value }}{%- endif -%} \n {%- if row.lab_test_uom -%}{{ row.lab_test_uom }}{%- endif -%}\n \n
\n {%- if row.normal_range -%}{{ row.normal_range }}{%- endif -%}\n
\n
\n\n \n \n {%- if doc.special_test_items -%}\n \n \n \n \n \n {%- for row in doc.special_test_items -%}\n \n \n \n \n\n {%- endfor -%}\n {%- endif -%}\n\n {%- if doc.sensitivity_test_items -%}\n \n \n \n \n {%- for row in doc.sensitivity_test_items -%}\n \n \n \n \n\n {%- endfor -%}\n {%- endif -%}\n\n \n
Name of TestResult
{{ doc.lab_test_name }}
  {{ row.lab_test_particulars }} \n {%- if row.result_value -%}{{ row.result_value }}{%- endif -%}\n
AntibioticSensitivity
{{ row.antibiotic }} {{ row.antibiotic_sensitivity }}
\n {%- endif -%}\n\n
\n {%- if (frappe.db.get_value(\"Healthcare Settings\", \"None\", \"employee_name_and_designation_in_print\") == '1') -%}\n
{{doc.employee_name}}
\n
{{doc.employee_designation}}
\n {%- else -%}\n
{{frappe.db.get_value(\"Healthcare Settings\", \"None\", \"custom_signature_in_print\") }}
\n {%- endif -%}\n
\n
\n", + "idx": 0, + "line_breaks": 0, + "modified": "2018-09-04 12:03:47.066918", + "modified_by": "Administrator", + "module": "Healthcare", + "name": "Lab Test Print", + "owner": "Administrator", + "print_format_builder": 0, + "print_format_type": "Server", + "show_section_headings": 0, "standard": "Yes" } \ No newline at end of file diff --git a/erpnext/healthcare/utils.py b/erpnext/healthcare/utils.py index 97bb98f677..bae0e4df6a 100644 --- a/erpnext/healthcare/utils.py +++ b/erpnext/healthcare/utils.py @@ -224,7 +224,7 @@ def manage_invoice_submit_cancel(doc, method): if frappe.get_meta(item.reference_dt).has_field("invoiced"): set_invoiced(item, method, doc.name) - if method=="on_submit" and frappe.db.get_value("Healthcare Settings", None, "create_test_on_si_submit") == '1': + if method=="on_submit" and frappe.db.get_value("Healthcare Settings", None, "create_lab_test_on_si_submit") == '1': create_multiple("Sales Invoice", doc.name) def set_invoiced(item, method, ref_invoice=None):