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 name: frm.doc.appointment
}, },
callback: function(data) { callback: function(data) {
frm.set_value('patient', data.message.patient); let values = {
frm.set_value('procedure_template', data.message.procedure_template); 'patient':data.message.patient,
frm.set_value('medical_department', data.message.department); 'procedure_template': data.message.procedure_template,
frm.set_value('start_date', data.message.appointment_date); 'medical_department': data.message.department,
frm.set_value('start_time', data.message.appointment_time); 'start_date': data.message.appointment_date,
frm.set_value('notes', data.message.notes); 'start_time': data.message.appointment_time,
frm.set_value('service_unit', data.message.service_unit); '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) { procedure_template: function(frm) {

View File

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

View File

@ -37,7 +37,7 @@ class ClinicalProcedure(Document):
template = frappe.get_doc('Clinical Procedure Template', self.procedure_template) template = frappe.get_doc('Clinical Procedure Template', self.procedure_template)
if template.sample: if template.sample:
patient = frappe.get_doc('Patient', self.patient) 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) frappe.db.set_value('Clinical Procedure', self.name, 'sample', sample_collection.name)
self.reload() self.reload()