Implementing Route Setup in ERPNext via Script for Document Types and Pages
Frappe|Linux
In ERPNext, setting up routes via scripts for document types and PDFs enables seamless navigation and accessibility within the system. This approach streamlines processes and enhances user experience by automating the generation and organization of routes for various documents and their corresponding PDF files. By employing scripting capabilities, users can efficiently configure routes, ensuring smooth transitions between different stages of document processing.
So far, I have some ways to implement routing in Frappe. 😁
- Using
set_route
for navigating to Document List view 📃
frappe.set_route(“List”, “<doctype-name>”);
Use filter on route.
frappe.route_options = {
"<filed_name>": '<value>'
};
2. Using frappe.new_doc
for navigating to new document 📃
frappe.new_doc(“<doctype-name>”);
Pass the value in new document while creating.
frappe.new_doc("<doctype-name>", {
<field_name>: <value>,
})
3. Using set_route
for navigating from page to specific document
frappe.set_route(‘Form’, ‘<doctype-name>’, <document_id);
4. Using frappe.urllib.get_full_url
for routing desired URL for doctypes, pages, and PDFs
var url = frappe.urllib.get_full_url( “/app/<doctype-name>/” + encodeURIComponent(<document-name>) ); window.open(url, ‘_blank’)
var url = frappe.urllib.get_full_url("/api/method/<path to function>"+ "?label_reference=" + encodeURIComponent(<documnet_name>))
const route_url = frappe.utils.get_form_link('List', '<doctype name>');
window.open(route_url, '_blank');
Hit clap 👏 if you are satisfied
Buy me a book 📖
Stackademic 🎓
Thank you for reading until the end. Before you go:
- Please consider clapping and following the writer! 👏
- Follow us X | LinkedIn | YouTube | Discord
- Visit our other platforms: In Plain English | CoFeed | Venture | Cubed
- More content at Stackademic.com