fix: show company-details popup only for the targeted print format/letterhead

This commit is contained in:
khushi8112
2025-11-07 12:55:14 +05:30
parent 5cc2cf530a
commit 4c8226eb18

View File

@@ -1,6 +1,16 @@
let beforePrintHandled = false;
frappe.realtime.on("sales_invoice_before_print", (data) => {
let print_format = $('input[data-fieldname="print_format"]').val();
let letterhead = $('input[data-fieldname="letterhead"]').val();
let allowed_print_formats = ["Sales Invoice Standard", "Sales Invoice with Item Image"];
let allowed_letterheads = ["Company Letterhead", "Company Letterhead - Grey"];
if (!allowed_print_formats.includes(print_format) && !allowed_letterheads.includes(letterhead)) {
return;
}
const route = frappe.get_route();
if (!beforePrintHandled && route[0] === "print" && route[1] === "Sales Invoice") {