chore: frappe.whitelist for doc methods (#25068)

* chore: frappe.whitelist for doc methods

* fix: incorrect spelling

* fix: sider issue

Co-authored-by: Sagar Vora <sagar@resilient.tech>
This commit is contained in:
Walstan Baptista
2021-03-31 12:30:32 +05:30
committed by GitHub
parent 353aa59c42
commit d6360755b9
79 changed files with 149 additions and 60 deletions

View File

@@ -54,6 +54,7 @@ class ClinicalProcedure(Document):
def set_title(self):
self.title = _('{0} - {1}').format(self.patient_name or self.patient, self.procedure_template)[:100]
@frappe.whitelist()
def complete_procedure(self):
if self.consume_stock and self.items:
stock_entry = make_stock_entry(self)
@@ -96,6 +97,7 @@ class ClinicalProcedure(Document):
if self.consume_stock and self.items:
return stock_entry
@frappe.whitelist()
def start_procedure(self):
allow_start = self.set_actual_qty()
if allow_start:
@@ -116,6 +118,7 @@ class ClinicalProcedure(Document):
return allow_start
@frappe.whitelist()
def make_material_receipt(self, submit=False):
stock_entry = frappe.new_doc('Stock Entry')

View File

@@ -14,6 +14,7 @@ class InpatientMedicationEntry(Document):
def validate(self):
self.validate_medication_orders()
@frappe.whitelist()
def get_medication_orders(self):
# pull inpatient medication orders based on selected filters
orders = get_pending_medication_orders(self)

View File

@@ -57,6 +57,7 @@ class InpatientMedicationOrder(Document):
self.db_set('status', status)
@frappe.whitelist()
def add_order_entries(self, order):
if order.get('drug_code'):
dosage = frappe.get_doc('Prescription Dosage', order.get('dosage'))

View File

@@ -53,12 +53,15 @@ class InpatientRecord(Document):
+ """ <b><a href="/app/Form/Inpatient Record/{0}">{0}</a></b>""".format(ip_record[0].name))
frappe.throw(msg)
@frappe.whitelist()
def admit(self, service_unit, check_in, expected_discharge=None):
admit_patient(self, service_unit, check_in, expected_discharge)
@frappe.whitelist()
def discharge(self):
discharge_patient(self)
@frappe.whitelist()
def transfer(self, service_unit, check_in, leave_from):
if leave_from:
patient_leave_service_unit(self, check_in, leave_from)

View File

@@ -111,6 +111,7 @@ class Patient(Document):
age_str = str(age.years) + ' ' + _("Years(s)") + ' ' + str(age.months) + ' ' + _("Month(s)") + ' ' + str(age.days) + ' ' + _("Day(s)")
return age_str
@frappe.whitelist()
def invoice_patient_registration(self):
if frappe.db.get_single_value('Healthcare Settings', 'registration_fee'):
company = frappe.defaults.get_user_default('company')

View File

@@ -113,6 +113,7 @@ class PatientAppointment(Document):
if fee_validity:
frappe.msgprint(_('{0} has fee validity till {1}').format(self.patient, fee_validity.valid_till))
@frappe.whitelist()
def get_therapy_types(self):
if not self.therapy_plan:
return

View File

@@ -34,6 +34,7 @@ class PatientHistorySettings(Document):
frappe.throw(_('Row #{0}: Field {1} in Document Type {2} is not a Date / Datetime field.').format(
entry.idx, frappe.bold(entry.date_fieldname), frappe.bold(entry.document_type)))
@frappe.whitelist()
def get_doctype_fields(self, document_type, fields):
multicheck_fields = []
doc_fields = frappe.get_meta(document_type).fields
@@ -49,6 +50,7 @@ class PatientHistorySettings(Document):
return multicheck_fields
@frappe.whitelist()
def get_date_field_for_dt(self, document_type):
meta = frappe.get_meta(document_type)
date_fields = meta.get('fields', {

View File

@@ -33,6 +33,7 @@ class TherapyPlan(Document):
self.db_set('total_sessions', total_sessions)
self.db_set('total_sessions_completed', total_sessions_completed)
@frappe.whitelist()
def set_therapy_details_from_template(self):
# Add therapy types in the child table
self.set('therapy_plan_details', [])