mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-24 20:46:38 +00:00
refactor: build document links with get_form_link in report formatters
This commit is contained in:
@@ -23,7 +23,10 @@ frappe.query_reports["Production Plan Summary"] = {
|
||||
|
||||
if (column.fieldname == "item_code") {
|
||||
var color = data.pending_qty > 0 ? "red" : "green";
|
||||
value = `<a style='color:${color}' href="/app/item/${data["item_code"]}" data-doctype="Item">${data["item_code"]}</a>`;
|
||||
value = `<a style='color:${color}' href="${frappe.utils.get_form_link(
|
||||
"Item",
|
||||
data["item_code"]
|
||||
)}" data-doctype="Item">${frappe.utils.escape_html(data["item_code"])}</a>`;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
@@ -68,7 +68,7 @@ frappe.query_reports["Serial No and Batch Traceability"] = {
|
||||
function getTraceabilityLink({ type, value, original_value, item_code, data, filter_values }) {
|
||||
if (!value) return value;
|
||||
|
||||
const base_url = type === "batch_no" ? "/app/batch/" : "/app/serial-no/";
|
||||
const link_doctype = type === "batch_no" ? "Batch" : "Serial No";
|
||||
const filter_list = filter_values[type]; // either batches or serial_nos
|
||||
|
||||
let css_class = "ellipsis";
|
||||
@@ -84,7 +84,10 @@ function getTraceabilityLink({ type, value, original_value, item_code, data, fil
|
||||
css_class = data.direction === "Backward" ? "ellipsis text-success" : "ellipsis text-danger";
|
||||
}
|
||||
|
||||
return `<a class="${css_class}" href="${base_url}${original_value}">${original_value}</a>`;
|
||||
return `<a class="${css_class}" href="${frappe.utils.get_form_link(
|
||||
link_doctype,
|
||||
original_value
|
||||
)}">${frappe.utils.escape_html(original_value)}</a>`;
|
||||
}
|
||||
|
||||
function custom_formatter(value, row, column, data, default_formatter) {
|
||||
|
||||
Reference in New Issue
Block a user