diff --git a/erpnext/patches/v9_2/remove_company_from_patient.py b/erpnext/patches/v9_2/remove_company_from_patient.py index ad9c9c5fe0..1ce344501d 100644 --- a/erpnext/patches/v9_2/remove_company_from_patient.py +++ b/erpnext/patches/v9_2/remove_company_from_patient.py @@ -1,5 +1,6 @@ import frappe def execute(): - if 'company' in frappe.db.get_table_columns("Patient"): - frappe.db.sql("alter table `tabPatient` drop column company") + if frappe.db.exists("DocType", "Patient"): + if 'company' in frappe.db.get_table_columns("Patient"): + frappe.db.sql("alter table `tabPatient` drop column company")