Merge pull request #17163 from frappe/mergify/bp/develop/pr-17161

fix: Handle case where document title can be NONE (backport #17161)
This commit is contained in:
Suraj Shetty 2022-06-13 11:47:27 +05:30 committed by GitHub
commit b1e97c1ff4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -438,7 +438,7 @@ class Document(BaseDocument):
def get_title(self):
"""Get the document title based on title_field or `title` or `name`"""
return self.get(self.meta.get_title_field())
return self.get(self.meta.get_title_field()) or ""
def set_title_field(self):
"""Set title field based on template"""

View file

@ -63,7 +63,7 @@ def get_context(context):
"body": body,
"print_style": print_style,
"comment": frappe.session.user,
"title": frappe.utils.strip_html(doc.get_title()),
"title": frappe.utils.strip_html(doc.get_title() or doc.name),
"lang": frappe.local.lang,
"layout_direction": "rtl" if is_rtl() else "ltr",
"doctype": frappe.form_dict.doctype,