Configuration - Create Lab Test on Sales Invoice Submit

This commit is contained in:
Jamsheer 2018-08-01 14:29:43 +05:30
parent 61574d18bf
commit 0ae100b035
2 changed files with 40 additions and 3 deletions

View File

@ -959,6 +959,38 @@
"translatable": 0, "translatable": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "create_test_on_si_submit",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Create Lab Test(s) on Sales Invoice Submit",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_in_quick_entry": 0, "allow_in_quick_entry": 0,
@ -1261,7 +1293,7 @@
"issingle": 1, "issingle": 1,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2018-07-20 16:22:51.148456", "modified": "2018-08-01 13:30:04.448397",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Healthcare", "module": "Healthcare",
"name": "Healthcare Settings", "name": "Healthcare Settings",
@ -1296,5 +1328,6 @@
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"track_changes": 1, "track_changes": 1,
"track_seen": 0 "track_seen": 0,
"track_views": 0
} }

View File

@ -11,6 +11,7 @@ from frappe.utils import time_diff_in_hours, rounded
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_income_account from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_income_account
from erpnext.healthcare.doctype.patient_appointment.patient_appointment import validity_exists from erpnext.healthcare.doctype.patient_appointment.patient_appointment import validity_exists
from erpnext.healthcare.doctype.fee_validity.fee_validity import create_fee_validity, update_fee_validity from erpnext.healthcare.doctype.fee_validity.fee_validity import create_fee_validity, update_fee_validity
from erpnext.healthcare.doctype.lab_test.lab_test import create_multiple
@frappe.whitelist() @frappe.whitelist()
def get_healthcare_services_to_invoice(patient): def get_healthcare_services_to_invoice(patient):
@ -224,6 +225,9 @@ def manage_invoice_submit_cancel(doc, method):
if frappe.get_meta(item.reference_dt).has_field("invoiced"): if frappe.get_meta(item.reference_dt).has_field("invoiced"):
set_invoiced(item, method, doc.name) set_invoiced(item, method, doc.name)
if method=="on_submit" and frappe.db.get_value("Healthcare Settings", None, "create_test_on_si_submit") == '1':
create_multiple("Sales Invoice", doc.name)
def set_invoiced(item, method, ref_invoice=None): def set_invoiced(item, method, ref_invoice=None):
invoiced = False invoiced = False
if(method=="on_submit"): if(method=="on_submit"):