refactor: download RFQ PDF
This commit is contained in:
parent
f7fd30fecf
commit
8e40c04494
@ -124,7 +124,6 @@ frappe.ui.form.on("Request for Quotation",{
|
|||||||
frappe.urllib.get_full_url(
|
frappe.urllib.get_full_url(
|
||||||
"/api/method/erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_pdf?" +
|
"/api/method/erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_pdf?" +
|
||||||
new URLSearchParams({
|
new URLSearchParams({
|
||||||
doctype: frm.doc.doctype,
|
|
||||||
name: frm.doc.name,
|
name: frm.doc.name,
|
||||||
supplier: data.supplier,
|
supplier: data.supplier,
|
||||||
print_format: data.print_format || "Standard",
|
print_format: data.print_format || "Standard",
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
@ -388,24 +389,26 @@ def create_rfq_items(sq_doc, supplier, data):
|
|||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_pdf(doctype, name, supplier, print_format=None, language=None, letterhead=None):
|
def get_pdf(
|
||||||
# permissions get checked in `download_pdf`
|
name: str,
|
||||||
if doc := get_rfq_doc(doctype, name, supplier):
|
supplier: str,
|
||||||
download_pdf(
|
print_format: Optional[str] = None,
|
||||||
doctype,
|
language: Optional[str] = None,
|
||||||
name,
|
letterhead: Optional[str] = None,
|
||||||
print_format,
|
):
|
||||||
doc=doc,
|
doc = frappe.get_doc("Request for Quotation", name)
|
||||||
language=language,
|
|
||||||
letterhead=letterhead or None,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def get_rfq_doc(doctype, name, supplier):
|
|
||||||
if supplier:
|
if supplier:
|
||||||
doc = frappe.get_doc(doctype, name)
|
|
||||||
doc.update_supplier_part_no(supplier)
|
doc.update_supplier_part_no(supplier)
|
||||||
return doc
|
|
||||||
|
# permissions get checked in `download_pdf`
|
||||||
|
download_pdf(
|
||||||
|
doc.doctype,
|
||||||
|
doc.name,
|
||||||
|
print_format,
|
||||||
|
doc=doc,
|
||||||
|
language=language,
|
||||||
|
letterhead=letterhead or None,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user