Skip to content

Commit 1435c66

Browse files
refactor: remove Doctype check in Python to allow user to add button via client scripts in other doctypes
1 parent 0859d6f commit 1435c66

2 files changed

Lines changed: 3 additions & 18 deletions

File tree

pdf_on_submit/public/js/pdf_button_utils.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
window.pdf_on_submit = window.pdf_on_submit || {};
44

5-
// Doctypes that support PDF button
5+
// Common doctypes with PDF button enabled by default
6+
// To enable for other doctypes, add a Client Script:
7+
// frappe.ui.form.on("Your DocType", { refresh: pdf_on_submit.add_pdf_button });
68
pdf_on_submit.ALLOWED_DOCTYPES = [
79
"Quotation",
810
"Sales Order",

pdf_on_submit/utils.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,13 @@
33
from pdf_on_submit.attach_pdf import get_matching_enabled_doctype
44

55

6-
ALLOWED_DOCTYPES = [
7-
"Quotation",
8-
"Sales Order",
9-
"Sales Invoice",
10-
"Delivery Note",
11-
"Dunning",
12-
"Request for Quotation",
13-
"Supplier Quotation",
14-
"Purchase Order",
15-
"Purchase Invoice",
16-
"Purchase Receipt",
17-
]
18-
19-
206
@frappe.whitelist()
217
def get_print_details(doctype: str, docname: str) -> tuple:
228
"""
239
Get print format and letter head for a document based on PDF on Submit Settings.
2410
2511
Returns: (print_format, letter_head)
2612
"""
27-
if doctype not in ALLOWED_DOCTYPES:
28-
frappe.throw(_("Print details not available for this document type"))
29-
3013
if not frappe.has_permission(doctype, "print", docname):
3114
frappe.throw(_("No permission to print this document"))
3215

0 commit comments

Comments
 (0)