diff --git a/addons/point_of_sale/static/src/app/utils/report_service.js b/addons/point_of_sale/static/src/app/utils/report_service.js index dac90e734bc..2ad164716b1 100644 --- a/addons/point_of_sale/static/src/app/utils/report_service.js +++ b/addons/point_of_sale/static/src/app/utils/report_service.js @@ -5,31 +5,31 @@ import { downloadFile } from "@web/core/network/download"; import { downloadReport } from "@web/webclient/actions/reports/utils"; export const reportService = { - dependencies: ["rpc", "user", "ui", "orm"], - start(env, { rpc, user, ui, orm }) { + dependencies: ["rpc", "user", "ui", "orm", "pos"], + start(env, { rpc, user, ui, orm, pos }) { const reportActionsCache = {}; return { async doAction(reportXmlId, active_ids) { ui.block(); try { - if (reportXmlId === "account.account_invoices"){ + if (reportXmlId === "account.account_invoices") { // Get the attachment previously generated by the Send and Print - let [pdf, filename] = await orm.call( + const [pdf, filename] = await orm.call( "account.move", "get_invoice_pdf_report_attachment", - [active_ids], + [active_ids] ); // Convert pdf to a Blob const byteArray = new Uint8Array(pdf.length); for (let i = 0; i < pdf.length; i++) { byteArray[i] = pdf.charCodeAt(i); } - const blob = new Blob([byteArray], {type: "application/pdf"}); + const blob = new Blob([byteArray], { type: "application/pdf" }); // Show the popup to save the pdf await downloadFile(blob, filename, "application/pdf"); } else { reportActionsCache[reportXmlId] ||= rpc("/web/action/load", { - action_id: reportXmlId, + action_id: reportXmlId, }); const reportAction = await reportActionsCache[reportXmlId]; // await instead of return because we want the ui to stay blocked