diff --git a/addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/ControlButtons/ReprintReceiptButton.js b/addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/ControlButtons/ReprintReceiptButton.js index 913f98af4e6..5a227827295 100644 --- a/addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/ControlButtons/ReprintReceiptButton.js +++ b/addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/ControlButtons/ReprintReceiptButton.js @@ -6,7 +6,6 @@ odoo.define('point_of_sale.ReprintReceiptButton', function (require) { const PosComponent = require('point_of_sale.PosComponent'); const OrderManagementScreen = require('point_of_sale.OrderManagementScreen'); const Registries = require('point_of_sale.Registries'); - const OrderReceipt = require('point_of_sale.OrderReceipt'); const contexts = require('point_of_sale.PosContext'); class ReprintReceiptButton extends PosComponent { @@ -19,18 +18,7 @@ odoo.define('point_of_sale.ReprintReceiptButton', function (require) { const order = this.orderManagementContext.selectedOrder; if (!order) return; - if (this.env.pos.proxy.printer) { - const fixture = document.createElement('div'); - const orderReceipt = new (Registries.Component.get(OrderReceipt))(this, { order }); - await orderReceipt.mount(fixture); - const receiptHtml = orderReceipt.el.outerHTML; - const printResult = await this.env.pos.proxy.printer.print_receipt(receiptHtml); - if (!printResult.successful) { - this.showTempScreen('ReprintReceiptScreen', { order: order }); - } - } else { - this.showTempScreen('ReprintReceiptScreen', { order: order }); - } + this.showScreen('ReprintReceiptScreen', { order: order }); } } ReprintReceiptButton.template = 'ReprintReceiptButton'; diff --git a/addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/ReprintReceiptScreen.js b/addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/ReprintReceiptScreen.js index ef5d396f616..1bd8d332ed4 100644 --- a/addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/ReprintReceiptScreen.js +++ b/addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/ReprintReceiptScreen.js @@ -6,12 +6,18 @@ odoo.define('point_of_sale.ReprintReceiptScreen', function (require) { const ReprintReceiptScreen = (AbstractReceiptScreen) => { class ReprintReceiptScreen extends AbstractReceiptScreen { - confirm() { - this.props.resolve({ confirmed: true, payload: null }); - this.trigger('close-temp-screen'); + mounted() { + this.tryReprint(); } - tryReprint() { - this._printReceipt(); + confirm() { + this.showScreen('OrderManagementScreen'); + } + async tryReprint() { + if(this.env.pos.proxy.printer && this.env.pos.config.iface_print_skip_screen) { + let result = await this._printReceipt(); + if(result) + this.showScreen('OrderManagementScreen'); + } } } ReprintReceiptScreen.template = 'ReprintReceiptScreen';