diff --git a/addons/point_of_sale/static/src/app/store/models.js b/addons/point_of_sale/static/src/app/store/models.js index af487dc0fc6..74b81ec4e8b 100644 --- a/addons/point_of_sale/static/src/app/store/models.js +++ b/addons/point_of_sale/static/src/app/store/models.js @@ -1632,7 +1632,7 @@ export class Order extends PosModel { } /** - * @returns {{ [productKey: string]: { product_id: number, name: string, note: string, quantity: number } }} + * @returns {{ [lineKey: string]: { product_id: number, name: string, note: string, quantity: number } }} * This function recalculates the information to be sent to the preparation tools, * it uses the variable lastOrderPrepaChange which contains the last changes sent * to perform this calculation. @@ -1650,7 +1650,6 @@ export class Order extends PosModel { const orderline = this.orderlines[orderlineIdx]; const product = orderline.get_product(); const note = orderline.getNote(); - const productKey = `${product.id} - ${orderline.get_full_product_name()} - ${note}`; const lineKey = `${orderline.uuid} - ${note}`; if ( prepaCategoryIds.size === 0 || @@ -1662,7 +1661,7 @@ export class Order extends PosModel { : quantity; if (quantityDiff && orderline.skipChange === skipped) { - changes[productKey] = { + changes[lineKey] = { name: orderline.get_full_product_name(), product_id: product.id, attribute_value_ids: orderline.attribute_value_ids, @@ -1686,9 +1685,9 @@ export class Order extends PosModel { // was last sent to the preparation tools. If so we add this to the changes. for (const [lineKey, lineResume] of Object.entries(this.lastOrderPrepaChange)) { if (!this.getOrderedLine(lineKey)) { - const productKey = `${lineResume["product_id"]} - ${lineResume["name"]} - ${lineResume["note"]}`; - if (!changes[productKey]) { - changes[productKey] = { + const lineKey = `${lineResume["line_uuid"]} - ${lineResume["note"]}`; + if (!changes[lineKey]) { + changes[lineKey] = { product_id: lineResume["product_id"], name: lineResume["name"], note: lineResume["note"], @@ -1696,7 +1695,7 @@ export class Order extends PosModel { quantity: -lineResume["quantity"], }; } else { - changes[productKey]["quantity"] -= lineResume["quantity"]; + changes[lineKey]["quantity"] -= lineResume["quantity"]; } } } diff --git a/addons/pos_self_order/static/src/app/pages/confirmation_page/confirmation_page.js b/addons/pos_self_order/static/src/app/pages/confirmation_page/confirmation_page.js index bc5b2636a7a..44a099eef73 100644 --- a/addons/pos_self_order/static/src/app/pages/confirmation_page/confirmation_page.js +++ b/addons/pos_self_order/static/src/app/pages/confirmation_page/confirmation_page.js @@ -27,9 +27,9 @@ export class ConfirmationPage extends Component { this.setDefautLanguage(); }, 5000); - setTimeout(() => { + setTimeout(async () => { try { - this.printer.print(OrderReceipt, { + await this.printer.print(OrderReceipt, { data: this.selfOrder.export_for_printing(this.confirmedOrder), formatCurrency: this.selfOrder.formatMonetary, });