Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
612 Ansichten

En este codigo js
/** @odoo-module */

import { _t } from "@web/core/l10n/translation";

import { useErrorHandlers } from "@point_of_sale/app/utils/hooks";

import { registry } from "@web/core/registry";

import { KitchenReceipt } from "./KitchenReceipt";

import { useState, Component } from "@odoo/owl";

import { usePos } from "@point_of_sale/app/store/pos_hook";

import { useService } from "@web/core/utils/hooks";


export class PrintKitchenReceiptScreen extends Component {    

static template = "pos_print_kitchen_receipt.PrintKitchenReceiptScreen";    

static components = { KitchenReceipt };    

setup() {        super.setup();        

this.pos = usePos();        

this.hardwareProxy = useService("hardware_proxy");        

this.printer = useService("printer");        

useErrorHandlers();        

this.ui = useState(useService("ui"));    

}

    async printReceipt() {        // Obtener la lista de impresoras de cocina habilitadas        

const kitchenPrinters = await this.hardwareProxy.get_kitchen_printers();   // Verificar si hay impresoras disponibles       

 if (kitchenPrinters.length > 0) {            

const firstPrinter = kitchenPrinters[0]; // Seleccionar la primera impresora

const isPrinted = await this.printer.print(                

firstPrinter, // Usar la primera impresora                {                   

 data: this.pos.get_order().export_for_printing(),                    

formatCurrency: this.env.utils.formatCurrency,                },        

{ webPrintFallback: true }    );} 

else {    console.error("No hay impresoras de cocina habilitadas.");


Y el resultado es el siguiente:


TypeError: this.hardwareProxy.get_kitchen_printers is not a function at PrintKitchenReceiptScreen.printReceipt (http://localhost:8075/web/assets/bc79012/point_of_sale.assets_prod.min.js:15578:69) at Object.mainEventHandler (http://localhost:8075/web/assets/bc79012/point_of_sale.assets_prod.min.js:1567:77) at HTMLButtonElement.listener (http://localhost:8075/web/assets/bc79012/point_of_sale.assets_prod.min.js:742:15)


Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Sept. 24
515
1
März 25
542
0
Jan. 25
530
1
Dez. 24
565
1
Dez. 24
826