run set query if doctype exist (#14929)

This commit is contained in:
Zarrar 2018-07-17 11:57:06 +05:30 committed by Nabin Hait
parent 107dbcdff8
commit fc0a5833a5

View File

@ -10,7 +10,8 @@ def execute():
'Timesheet', 'Sales Person', 'Payroll Employee Detail']
for doctype in doctypes_to_update:
frappe.db.sql("""
update `tab%s` dt
set department=(select department from `tabEmployee` where name=dt.employee)
""" % doctype)
if frappe.db.table_exists(doctype):
frappe.db.sql("""
update `tab%s` dt
set department=(select department from `tabEmployee` where name=dt.employee)
""" % doctype)