fix: permission in bom compare tool

(cherry picked from commit e6fdb3702a)
This commit is contained in:
Rohit Waghchaure
2026-06-13 19:09:04 +05:30
committed by Mergify
parent 5addc66301
commit ef3046dca2

View File

@@ -96,8 +96,8 @@ erpnext.BOMComparisonTool = class BOMComparisonTool {
return ` return `
<tr> <tr>
<td>${frappe.meta.get_label(doctype, fieldname)}</td> <td>${frappe.meta.get_label(doctype, fieldname)}</td>
<td>${value1}</td> <td>${frappe.utils.escape_html(cstr(value1))}</td>
<td>${value2}</td> <td>${frappe.utils.escape_html(cstr(value2))}</td>
</tr> </tr>
`; `;
}) })
@@ -138,13 +138,17 @@ erpnext.BOMComparisonTool = class BOMComparisonTool {
.map((change, i) => { .map((change, i) => {
let [fieldname, value1, value2] = change; let [fieldname, value1, value2] = change;
let th = let th =
i === 0 ? `<th rowspan="${values_changed.length}">${item_code}</th>` : ""; i === 0
? `<th rowspan="${values_changed.length}">${frappe.utils.escape_html(
cstr(item_code)
)}</th>`
: "";
return ` return `
<tr> <tr>
${th} ${th}
<td>${frappe.meta.get_label(child_doctype, fieldname)}</td> <td>${frappe.meta.get_label(child_doctype, fieldname)}</td>
<td>${value1}</td> <td>${frappe.utils.escape_html(cstr(value1))}</td>
<td>${value2}</td> <td>${frappe.utils.escape_html(cstr(value2))}</td>
</tr> </tr>
`; `;
}) })
@@ -177,7 +181,9 @@ erpnext.BOMComparisonTool = class BOMComparisonTool {
let html = rows let html = rows
.map((row) => { .map((row) => {
let [, doc] = row; let [, doc] = row;
let cells = fields.map((df) => `<td>${doc[df.fieldname]}</td>`).join(""); let cells = fields
.map((df) => `<td>${frappe.utils.escape_html(cstr(doc[df.fieldname]))}</td>`)
.join("");
return `<tr>${cells}</tr>`; return `<tr>${cells}</tr>`;
}) })
.join(""); .join("");