This commit is contained in:
Suraj Shetty 2022-02-19 10:57:58 +05:30
parent 0ce8f83343
commit 54b6bbce96
2 changed files with 20 additions and 1 deletions

View file

@ -240,6 +240,7 @@ frappe.ui.form.Share = class Share {
fieldtype: "Table",
data: document_links,
read_only: 1,
hidden: 1,
fields: [{
fieldname: "key",
label: __("Key"),
@ -252,8 +253,14 @@ frappe.ui.form.Share = class Share {
fieldtype: "Date",
in_list_view: true
}]
}, {
fieldname: "links",
label: __("Previous Links"),
fieldtype: "HTML",
options: `<div>Links</div>`,
}],
});
share_modal.show();
}
};

View file

@ -92,7 +92,19 @@ def read_multi_pdf(output):
def download_pdf(doctype, name, format=None, doc=None, no_letterhead=0):
doc = frappe.get_doc(doctype, name)
doc.doctype = doctype
validate_print_permission(doc)
try:
validate_print_permission(doc)
except frappe.exceptions.LinkExpiredError:
frappe.local.response.http_status_code = 410
frappe.local.response = frappe.get_template("templates/print_format/print_key_invalid.html").render({})
return
except frappe.exceptions.InvalidKey:
frappe.local.response.type = "page"
frappe.local.response.message = frappe.get_template("templates/print_format/print_key_invalid.html").render({})
frappe.local.response.http_status_code = 401
# frappe.local.response.route = "/api/method/frappe.utils.print_format.download_pdf"
return
html = frappe.get_print(doctype, name, format, doc=doc, no_letterhead=no_letterhead)
frappe.local.response.filename = "{name}.pdf".format(name=name.replace(" ", "-").replace("/", "-"))
frappe.local.response.filecontent = get_pdf(html)