From 479e0c1439ce7f7165fc9b285fe131b1dd5f2a64 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Tue, 24 Jan 2023 12:39:55 +0530 Subject: [PATCH 1/2] fix: clear cache on every update in notifications This feels like duplicate but ensures that it gets cleared in every case. E.g. Some class might have overridden validate or ignore_validate might be set in which case cache doesn't get cleared. --- frappe/email/doctype/notification/notification.py | 1 + 1 file changed, 1 insertion(+) diff --git a/frappe/email/doctype/notification/notification.py b/frappe/email/doctype/notification/notification.py index 41fdfeeda1..ce19fb7b07 100644 --- a/frappe/email/doctype/notification/notification.py +++ b/frappe/email/doctype/notification/notification.py @@ -45,6 +45,7 @@ class Notification(Document): frappe.cache().hdel("notifications", self.document_type) def on_update(self): + frappe.cache().hdel("notifications", self.document_type) path = export_module_json(self, self.is_standard, self.module) if path: # js From be7fd7a58d0ffe8210f09c0bc8c1c849f8ac574d Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Tue, 24 Jan 2023 12:01:00 +0530 Subject: [PATCH 2/2] fix: point to custom field link instead --- frappe/desk/form/meta.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/frappe/desk/form/meta.py b/frappe/desk/form/meta.py index 8b1408f1b5..90d20c8fc4 100644 --- a/frappe/desk/form/meta.py +++ b/frappe/desk/form/meta.py @@ -11,6 +11,7 @@ from frappe.model.utils import render_include from frappe.modules import get_module_path, load_doctype_module, scrub from frappe.translate import extract_messages_from_code, make_dict_from_messages from frappe.utils import get_html_format +from frappe.utils.data import get_link_to_form ASSET_KEYS = ( "__js", @@ -199,14 +200,19 @@ class FormMeta(Meta): # customizations are removed or some custom app is removed but hasn't cleaned # up after itself. frappe.clear_last_message() - customize_form_link = f'Customize Form' - frappe.throw( - _( - "Field {0} is referring to non-existing doctype {1}, please remove the field from {2} or add the required doctype." - ).format(frappe.bold(df.fieldname), frappe.bold(df.options), customize_form_link), - title=_("Missing DocType"), + + msg = _("Field {0} is referring to non-existing doctype {1}.").format( + frappe.bold(df.fieldname), frappe.bold(df.options) ) + if df.get("is_custom_field"): + custom_field_link = get_link_to_form("Custom Field", df.name) + msg += " " + _("Please delete the field from {2} or add the required doctype.").format( + custom_field_link + ) + + frappe.throw(msg, title=_("Missing DocType")) + def add_linked_document_type(self): for df in self.get("fields", {"fieldtype": "Link"}): if df.options: