diff --git a/erpnext/patches/v4_2/fix_account_master_type.py b/erpnext/patches/v4_2/fix_account_master_type.py index 09fa7891d09..d4603f24f59 100644 --- a/erpnext/patches/v4_2/fix_account_master_type.py +++ b/erpnext/patches/v4_2/fix_account_master_type.py @@ -6,7 +6,7 @@ import frappe def execute(): for d in frappe.db.sql("""select name from `tabAccount` - where ifnull(master_type, '') not in ('Customer', 'Supplier', 'Employee', '')"""): + where ifnull(master_type, '') not in ('Customer', 'Supplier', 'Employee', '') and docstatus=0"""): ac = frappe.get_doc("Account", d[0]) ac.master_type = None ac.save()