diff --git a/frappe/printing/doctype/print_format/print_format.py b/frappe/printing/doctype/print_format/print_format.py index f19c0af9bf..74dc5460d9 100644 --- a/frappe/printing/doctype/print_format/print_format.py +++ b/frappe/printing/doctype/print_format/print_format.py @@ -71,8 +71,19 @@ class PrintFormat(Document): self.export_doc() + def after_rename(self, old: str, new: str, *args, **kwargs): + if self.doc_type: + frappe.clear_cache(doctype=self.doc_type) + + # update property setter default_print_format if set + frappe.db.set_value("Property Setter", { + "doctype_or_field": "DocType", + "doc_type": self.doc_type, + "property": "default_print_format", + "value": old, + }, "value", new) + def export_doc(self): - # export from frappe.modules.utils import export_module_json export_module_json(self, self.standard == 'Yes', self.module)