diff --git a/erpnext/patches/v11_0/make_job_card.py b/erpnext/patches/v11_0/make_job_card.py index ad9a9af9ef..9c41c0b991 100644 --- a/erpnext/patches/v11_0/make_job_card.py +++ b/erpnext/patches/v11_0/make_job_card.py @@ -16,9 +16,9 @@ def execute(): fieldname = frappe.db.get_value('DocField', {'fieldname': 'production_order', 'parent': 'Timesheet'}, 'fieldname') if not fieldname: return - for d in frappe.db.sql("""select %(fieldname)s, name from tabTimesheet - where (%(fieldname)s is not null and %(fieldname)s != '') and docstatus = 0""", - {'fieldname': fieldname}, as_dict=1): + for d in frappe.get_all('Timesheet', + filters={fieldname: ['!=', ""], 'docstatus': 0}, + fields=[fieldname, 'name']): if d[fieldname]: doc = frappe.get_doc('Work Order', d[fieldname]) for row in doc.operations: