[IMP] point_of_sale: add bidimensional code on receipt chile
This commit adds the requirements in order to add the bidimensional code on the receipt of the point of sale for the Chilean localization. closes odoo/odoo#161342 Task-id: 3747828 Related: odoo/enterprise#60451 Signed-off-by: Vlad Stroia (vlst) <vlst@odoo.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user