From b488475d9268861a09c634e427febba8cd344adf Mon Sep 17 00:00:00 2001 From: Jamsheer Date: Tue, 28 Nov 2017 10:47:06 +0530 Subject: [PATCH] Remove Company from Patient - Patches Added (#11716) * Remove Company from Patient - Patches Added * Update patient DOB field label to Date of birth * Patient marital status default null * Update patient.py --- .../healthcare/doctype/patient/patient.json | 37 ++----------------- erpnext/healthcare/doctype/patient/patient.py | 7 +++- erpnext/patches.txt | 1 + .../v9_2/remove_company_from_patient.py | 5 +++ 4 files changed, 14 insertions(+), 36 deletions(-) create mode 100644 erpnext/patches/v9_2/remove_company_from_patient.py diff --git a/erpnext/healthcare/doctype/patient/patient.json b/erpnext/healthcare/doctype/patient/patient.json index c137aeed22..21bef3071c 100644 --- a/erpnext/healthcare/doctype/patient/patient.json +++ b/erpnext/healthcare/doctype/patient/patient.json @@ -185,7 +185,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "DOB", + "label": "Date of birth", "length": 0, "no_copy": 0, "permlevel": 0, @@ -353,37 +353,6 @@ "set_only_once": 1, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "company", - "fieldtype": "Link", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Company", - "length": 0, - "no_copy": 0, - "options": "Company", - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 1, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -884,7 +853,7 @@ "label": "Marital Status", "length": 0, "no_copy": 0, - "options": "Single\nMarried\nDivorced\nWidow", + "options": "\nSingle\nMarried\nDivorced\nWidow", "permlevel": 0, "precision": "", "print_hide": 0, @@ -1274,7 +1243,7 @@ "issingle": 0, "istable": 0, "max_attachments": 50, - "modified": "2017-11-22 14:21:56.653361", + "modified": "2017-11-24 12:39:33.061005", "modified_by": "Administrator", "module": "Healthcare", "name": "Patient", diff --git a/erpnext/healthcare/doctype/patient/patient.py b/erpnext/healthcare/doctype/patient/patient.py index f4d9a43ea3..e73482d87c 100644 --- a/erpnext/healthcare/doctype/patient/patient.py +++ b/erpnext/healthcare/doctype/patient/patient.py @@ -69,7 +69,10 @@ class Patient(Document): frappe.db.set_value("Patient", self.name, "disabled", 0) send_registration_sms(self) if(frappe.get_value("Healthcare Settings", None, "registration_fee")>0): - sales_invoice = make_invoice(self.name, self.company) + company = frappe.defaults.get_user_default('company') + if not company: + company = frappe.db.get_value("Global Defaults", None, "default_company") + sales_invoice = make_invoice(self.name, company) sales_invoice.save(ignore_permissions=True) return {'invoice': sales_invoice.name} @@ -110,7 +113,7 @@ def make_invoice(patient, company): return sales_invoice @frappe.whitelist() -def get_patient_detail(patient, company=None): +def get_patient_detail(patient): patient_dict = frappe.db.sql("""select * from tabPatient where name=%s""", (patient), as_dict=1) if not patient_dict: frappe.throw("Patient not found") diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 6c27c8e40a..f057b80b19 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -462,4 +462,5 @@ erpnext.patches.v9_0.update_employee_loan_details erpnext.patches.v9_2.delete_healthcare_domain_default_items erpnext.patches.v9_2.rename_translated_domains_in_en erpnext.patches.v9_2.repost_reserved_qty_for_production +erpnext.patches.v9_2.remove_company_from_patient erpnext.patches.v9_2.set_item_name_in_production_order \ No newline at end of file diff --git a/erpnext/patches/v9_2/remove_company_from_patient.py b/erpnext/patches/v9_2/remove_company_from_patient.py new file mode 100644 index 0000000000..ad9c9c5fe0 --- /dev/null +++ b/erpnext/patches/v9_2/remove_company_from_patient.py @@ -0,0 +1,5 @@ +import frappe + +def execute(): + if 'company' in frappe.db.get_table_columns("Patient"): + frappe.db.sql("alter table `tabPatient` drop column company")