feat: multi company support

This commit is contained in:
anoop 2020-04-13 16:32:35 +05:30
parent 5f923fce2d
commit 0686c3d729
3 changed files with 79 additions and 16 deletions

View File

@ -175,16 +175,37 @@ frappe.ui.form.on('Clinical Procedure', {
name: frm.doc.appointment
},
callback: function(data) {
frm.set_value('patient', data.message.patient);
frm.set_value('procedure_template', data.message.procedure_template);
frm.set_value('medical_department', data.message.department);
frm.set_value('start_date', data.message.appointment_date);
frm.set_value('start_time', data.message.appointment_time);
frm.set_value('notes', data.message.notes);
frm.set_value('service_unit', data.message.service_unit);
let values = {
'patient':data.message.patient,
'procedure_template': data.message.procedure_template,
'medical_department': data.message.department,
'start_date': data.message.appointment_date,
'start_time': data.message.appointment_time,
'notes': data.message.notes,
'service_unit': data.message.service_unit,
'company': data.message.company
}
frm.set_value(values);
}
});
}
else{
let values = {
'patient': '',
'patient_name': '',
'patient_sex': '',
'patient_age': '',
'medical_department': '',
'procedure_template': '',
'start_date': '',
'start_time': '',
'notes': '',
'service_unit': '',
'inpatient_record': ''
// 'inpatient_status': ''
};
frm.set_value(values);
}
},
procedure_template: function(frm) {

View File

@ -7,16 +7,18 @@
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"inpatient_record",
"naming_series",
"procedure_template",
"appointment",
"column_break_30",
"procedure_template",
"section_break_6",
"patient",
"patient_name",
"patient_sex",
"patient_age",
"prescription",
"medical_department",
"practitioner",
"practitioner_name",
"column_break_7",
"status",
"service_unit",
@ -26,7 +28,6 @@
"sample",
"invoiced",
"notes",
"company",
"consumables_section",
"consume_stock",
"items",
@ -36,6 +37,11 @@
"consumable_total_amount",
"column_break_27",
"consumption_details",
"sb_refs",
"inpatient_record",
"company",
"column_break_34",
"prescription",
"amended_from"
],
"fields": [
@ -56,7 +62,7 @@
{
"fieldname": "appointment",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Appointment",
"options": "Patient Appointment"
},
@ -64,7 +70,7 @@
"fetch_from": "inpatient_record.patient",
"fieldname": "patient",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Patient",
"options": "Patient",
"reqd": 1
@ -88,17 +94,20 @@
"fieldtype": "Link",
"hidden": 1,
"label": "Procedure Prescription",
"options": "Procedure Prescription"
"options": "Procedure Prescription",
"read_only": 1
},
{
"fieldname": "medical_department",
"fieldtype": "Link",
"in_standard_filter": 1,
"label": "Medical Department",
"options": "Medical Department"
},
{
"fieldname": "practitioner",
"fieldtype": "Link",
"in_standard_filter": 1,
"label": "Healthcare Practitioner",
"options": "Healthcare Practitioner"
},
@ -237,11 +246,43 @@
{
"fieldname": "section_break_24",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_30",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_6",
"fieldtype": "Section Break"
},
{
"collapsible": 1,
"fieldname": "sb_refs",
"fieldtype": "Section Break"
},
{
"fetch_from": "patient.patient_name",
"fieldname": "patient_name",
"fieldtype": "Data",
"label": "Patient Name",
"read_only": 1
},
{
"fetch_from": "practitioner.practitioner_name",
"fieldname": "practitioner_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Practitioner Name",
"read_only": 1
},
{
"fieldname": "column_break_34",
"fieldtype": "Column Break"
}
],
"is_submittable": 1,
"links": [],
"modified": "2020-03-02 11:44:27.970651",
"modified": "2020-04-03 23:06:04.009856",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Clinical Procedure",
@ -263,5 +304,6 @@
"restrict_to_domain": "Healthcare",
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "patient_name",
"track_changes": 1
}

View File

@ -37,7 +37,7 @@ class ClinicalProcedure(Document):
template = frappe.get_doc('Clinical Procedure Template', self.procedure_template)
if template.sample:
patient = frappe.get_doc('Patient', self.patient)
sample_collection = create_sample_doc(template, patient, None)
sample_collection = create_sample_doc(template, patient, None, self.company)
frappe.db.set_value('Clinical Procedure', self.name, 'sample', sample_collection.name)
self.reload()