From 83b5976b85e72981327184f01cdeed2ac4d63209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20De=20Andr=C3=A9s?= Date: Thu, 17 Aug 2023 11:17:59 +0200 Subject: [PATCH] [16.0][FIX] pos_order_remove_line: Trigger - Function logic is modified in order to use the numpad backspace trigger. - Stops event propagation and prevents default actions. --- .../static/src/js/orderline.esm.js | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/pos_order_remove_line/static/src/js/orderline.esm.js b/pos_order_remove_line/static/src/js/orderline.esm.js index bf342e6745..ebcacbfd38 100644 --- a/pos_order_remove_line/static/src/js/orderline.esm.js +++ b/pos_order_remove_line/static/src/js/orderline.esm.js @@ -10,23 +10,10 @@ import Registries from "point_of_sale.Registries"; const PosOrderline = (Orderline) => class extends Orderline { async removeLine(ev) { - const order = this.env.pos.get_order(); - if (order) { - ev.stopPropagation(); - ev.preventDefault(); - this.selectLine(); - const selected_line = order.get_selected_orderline(); - selected_line.set_quantity("remove"); - order.remove_orderline(selected_line); - this.checkRewardLines(order); - } - } - // Dependecy-less suport to pos_loyalty - checkRewardLines(order) { - const anyRewardLine = order.orderlines.some((line) => line.is_reward_line); - if (anyRewardLine) { - order._updateRewards(); - } + ev.stopPropagation(); + ev.preventDefault(); + this.selectLine(); + this.trigger("update-selected-orderline", {buffer: null, key: "Backspace"}); } }; Registries.Component.extend(Orderline, PosOrderline);