From 88bbeaf3d127820dd1b90709e968ded0e177d7f9 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 22 Oct 2020 17:44:46 +0530 Subject: [PATCH] fix: Clear user cache on doctype insert No need to do Settings -> Reload after creating a new doctype --- frappe/core/doctype/doctype/doctype.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py index 9d37849746..1aa6beb6a6 100644 --- a/frappe/core/doctype/doctype/doctype.py +++ b/frappe/core/doctype/doctype/doctype.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import re, copy, os, shutil import json +from frappe.cache_manager import clear_user_cache # imports - third party imports import six @@ -103,6 +104,10 @@ class DocType(Document): self.owner = 'Administrator' self.modified_by = 'Administrator' + def after_insert(self): + # clear user cache so that on the next reload this doctype is included in boot + clear_user_cache(frappe.session.user) + def set_default_in_list_view(self): '''Set default in-list-view for first 4 mandatory fields''' if not [d.fieldname for d in self.fields if d.in_list_view]: