fix(regional)!: remove irs_1099_print whitelisted method (backport #58976) (#58992)

Co-authored-by: Diptanil Saha <diptanil@frappe.io>
This commit is contained in:
mergify[bot]
2026-09-11 04:22:56 +00:00
committed by GitHub
parent 9bc98efe2f
commit d0b8379404
2 changed files with 0 additions and 56 deletions

View File

@@ -31,20 +31,4 @@ frappe.query_reports["IRS 1099"] = {
width: 80,
},
],
onload: function (query_report) {
query_report.page.add_inner_button(__("Print IRS 1099 Forms"), () => {
build_1099_print(query_report);
});
},
};
function build_1099_print(query_report) {
let filters = JSON.stringify(query_report.get_values());
let w = window.open(
"/api/method/erpnext.regional.report.irs_1099.irs_1099.irs_1099_print?" +
"&filters=" +
encodeURIComponent(filters)
);
// w.print();
}

View File

@@ -84,46 +84,6 @@ def get_columns():
]
@frappe.whitelist()
def irs_1099_print(filters):
if not filters:
frappe._dict(
{
"company": frappe.db.get_default("Company"),
"fiscal_year": frappe.db.get_default("Fiscal Year"),
}
)
else:
filters = frappe._dict(json.loads(filters))
fiscal_year_doc = get_fiscal_year(fiscal_year=filters.fiscal_year, as_dict=True)
fiscal_year = cstr(fiscal_year_doc.year_start_date.year)
company_address = get_payer_address_html(filters.company)
company_tin = frappe.db.get_value("Company", filters.company, "tax_id")
columns, data = execute(filters)
template = frappe.get_doc("Print Format", "IRS 1099 Form").html
output = PdfWriter()
for row in data:
row["fiscal_year"] = fiscal_year
row["company"] = filters.company
row["company_tin"] = company_tin
row["payer_street_address"] = company_address
row["recipient_street_address"], row["recipient_city_state"] = get_street_address_html(
"Supplier", row.supplier
)
row["payments"] = fmt_money(row["payments"], precision=0, currency="USD")
get_pdf(render_template(template, row), output=output if output else None)
frappe.local.response.filename = (
f"{filters.fiscal_year} {filters.company} IRS 1099 Forms{IRS_1099_FORMS_FILE_EXTENSION}"
)
frappe.local.response.filecontent = read_multi_pdf(output)
frappe.local.response.type = "download"
def get_payer_address_html(company):
address_list = frappe.db.sql(
"""