diff --git a/addons/pos_loyalty/static/src/js/OrderWidget.js b/addons/pos_loyalty/static/src/js/OrderWidget.js deleted file mode 100644 index bb5ef91ed2d..00000000000 --- a/addons/pos_loyalty/static/src/js/OrderWidget.js +++ /dev/null @@ -1,41 +0,0 @@ -/** @odoo-module **/ - -import { OrderWidget } from "@point_of_sale/js/Screens/ProductScreen/OrderWidget"; -import { patch } from "@web/core/utils/patch"; - -patch(OrderWidget.prototype, "pos_loyalty.OrderWidget", { - getActiveProgramsAndRewards() { - const order = this.env.pos.get_order(); - const activePrograms = Object.values(order.couponPointChanges).map( - (pe) => this.env.pos.program_by_id[pe.program_id] - ); - const seenRewards = new Set(); - const activeRewards = []; - for (const line of order._get_reward_lines()) { - const key = line.reward_id + "-" + line.coupon_id + "-" + line.reward_identifier_code; - if (seenRewards.has(key)) { - continue; - } - seenRewards.add(key); - const dbCoupon = this.env.pos.couponCache[line.coupon_id]; - const couponCode = dbCoupon ? dbCoupon.code : false; - activeRewards.push({ - id: line.cid, - name: line.get_product().display_name, - code: couponCode, - }); - } - const activeCoupons = order.codeActivatedCoupons.map((coupon) => { - const program = this.env.pos.program_by_id[coupon.program_id]; - return { - programName: program.name, - code: coupon.code, - }; - }); - return { - activePrograms: [...new Set(activePrograms)], - activeCoupons, - activeRewards, - }; - }, -}); diff --git a/addons/pos_loyalty/static/src/tours/PosLoyaltyTour.js b/addons/pos_loyalty/static/src/tours/PosLoyaltyTour.js index df1ce6de2df..970fc997544 100644 --- a/addons/pos_loyalty/static/src/tours/PosLoyaltyTour.js +++ b/addons/pos_loyalty/static/src/tours/PosLoyaltyTour.js @@ -38,7 +38,7 @@ ProductScreen.exec.addOrderline("Desk Organizer", "9"); PosLoyalty.check.hasRewardLine("on the cheapest product", "-4.59"); PosLoyalty.exec.removeRewardLine("90% on the cheapest product"); PosLoyalty.check.orderTotalIs("45.90"); -PosLoyalty.do.enterCode("invalid_code", false); +PosLoyalty.do.enterCode("invalid_code"); PosLoyalty.check.notificationMessageContains("invalid_code"); PosLoyalty.do.enterCode("1234"); PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-15.30"); @@ -67,7 +67,7 @@ ProductScreen.exec.addOrderline("Desk Organizer", "3"); // 5.1 ProductScreen.exec.addOrderline("Letter Tray", "4"); // 4.8 tax 10% PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-1.78"); PosLoyalty.check.orderTotalIs("54.44"); -PosLoyalty.do.enterCode("promocode", false); +PosLoyalty.do.enterCode("promocode"); PosLoyalty.check.hasRewardLine("50% on specific products", "-16.66"); // 17.55 - 1.78*0.5 PosLoyalty.check.orderTotalIs("37.78"); PosLoyalty.exec.finalizeOrder("Cash", "50"); @@ -130,7 +130,7 @@ PosLoyalty.exec.finalizeOrder("Cash", "65"); ProductScreen.exec.addOrderline("Desk Organizer", "6"); // 5.1 per item PosLoyalty.check.hasRewardLine("on the cheapest product", "-4.59"); PosLoyalty.exec.removeRewardLine("90% on the cheapest product"); -PosLoyalty.do.enterCode("promocode", false); +PosLoyalty.do.enterCode("promocode"); PosLoyalty.check.hasRewardLine("50% on specific products", "-15.30"); PosLoyalty.do.enterCode("1357"); PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-10.20"); diff --git a/addons/pos_loyalty/static/src/tours/PosLoyaltyTourMethods.js b/addons/pos_loyalty/static/src/tours/PosLoyaltyTourMethods.js index f5a591ed9c3..f8363500e91 100644 --- a/addons/pos_loyalty/static/src/tours/PosLoyaltyTourMethods.js +++ b/addons/pos_loyalty/static/src/tours/PosLoyaltyTourMethods.js @@ -25,7 +25,7 @@ class Do { }, ]; } - enterCode(code, valid = true) { + enterCode(code) { const steps = [ { content: "open code input dialog", @@ -41,13 +41,6 @@ class Do { trigger: ".popup-textinput .button.confirm", }, ]; - if (valid) { - steps.push({ - content: "wait for the coupon to be loaded", - trigger: `.active-coupon:contains("(${code})")`, - run: () => {}, - }); - } return steps; } resetActivePrograms() { diff --git a/addons/pos_loyalty/static/src/xml/OrderWidget.xml b/addons/pos_loyalty/static/src/xml/OrderWidget.xml deleted file mode 100644 index eb1b3d95ae1..00000000000 --- a/addons/pos_loyalty/static/src/xml/OrderWidget.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -
-
-
Active Programs
- -
- -
-
-
-
-
Active Coupons
- -
- () -
-
-
-
-
Active Rewards
- -
- -
-
-
-
-
-
-