diff --git a/erpnext/patches/v11_0/create_department_records_for_each_company.py b/erpnext/patches/v11_0/create_department_records_for_each_company.py index bef524c34b..17e3ebd07f 100644 --- a/erpnext/patches/v11_0/create_department_records_for_each_company.py +++ b/erpnext/patches/v11_0/create_department_records_for_each_company.py @@ -47,6 +47,9 @@ def update_records(doctype, comp_dict): THEN "%s" '''%(company, department, records[department])) + if not when_then: + return + frappe.db.sql(""" update `tab%s`