Reload doctype in patch
diff --git a/erpnext/patches/v5_1/fix_credit_days_based_on.py b/erpnext/patches/v5_1/fix_credit_days_based_on.py
index 9277818..f9c91f8 100644
--- a/erpnext/patches/v5_1/fix_credit_days_based_on.py
+++ b/erpnext/patches/v5_1/fix_credit_days_based_on.py
@@ -4,5 +4,6 @@
def execute():
for dt in ("Customer", "Customer Group", "Company"):
+ frappe.reload_doctype(dt)
frappe.db.sql("""update `tab{0}` set credit_days_based_on='Fixed Days'
where ifnull(credit_days, 0) > 0""".format(dt))
\ No newline at end of file