瀏覽代碼

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

fix: Handle case where document title can be NONE (backport #17161)
version-14
Suraj Shetty 3 年之前
committed by GitHub
父節點
當前提交
b1e97c1ff4
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. +1
    -1
      frappe/model/document.py
  2. +1
    -1
      frappe/www/printview.py

+ 1
- 1
frappe/model/document.py 查看文件

@@ -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"""


+ 1
- 1
frappe/www/printview.py 查看文件

@@ -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,


Loading…
取消
儲存