diff --git a/addons/point_of_sale/static/src/app/navbar/navbar.js b/addons/point_of_sale/static/src/app/navbar/navbar.js index 23ee574e7d9..5e793d75003 100644 --- a/addons/point_of_sale/static/src/app/navbar/navbar.js +++ b/addons/point_of_sale/static/src/app/navbar/navbar.js @@ -5,13 +5,13 @@ import { useService } from "@web/core/utils/hooks"; import { CashierName } from "@point_of_sale/js/ChromeWidgets/CashierName"; import { CustomerFacingDisplayButton } from "@point_of_sale/js/ChromeWidgets/CustomerFacingDisplayButton"; -import { HeaderButton } from "@point_of_sale/js/ChromeWidgets/HeaderButton"; import { ProxyStatus } from "@point_of_sale/js/ChromeWidgets/ProxyStatus"; import { SaleDetailsButton } from "@point_of_sale/js/ChromeWidgets/SaleDetailsButton"; import { SyncNotification } from "@point_of_sale/js/ChromeWidgets/SyncNotification"; import { CashMovePopup } from "./cash_move_popup/cash_move_popup"; import { TicketScreen } from "@point_of_sale/js/Screens/TicketScreen/TicketScreen"; import { Component, useState, useExternalListener } from "@odoo/owl"; +import { ClosePosPopup } from "@point_of_sale/js/Popups/ClosePosPopup"; export class Navbar extends Component { static template = "point_of_sale.Navbar"; @@ -19,7 +19,6 @@ export class Navbar extends Component { // FIXME POSREF remove some of these components CashierName, CustomerFacingDisplayButton, - HeaderButton, ProxyStatus, SaleDetailsButton, SyncNotification, @@ -97,4 +96,9 @@ export class Navbar extends Component { openMenu() { this.state.isMenuOpened = true; } + + async closeSession() { + const info = await this.pos.globalState.getClosePosInfo(); + this.popup.add(ClosePosPopup, { info, keepBehind: true }); + } } diff --git a/addons/point_of_sale/static/src/app/navbar/navbar.xml b/addons/point_of_sale/static/src/app/navbar/navbar.xml index 3fb3f62b6d4..8ee47f6643d 100644 --- a/addons/point_of_sale/static/src/app/navbar/navbar.xml +++ b/addons/point_of_sale/static/src/app/navbar/navbar.xml @@ -37,9 +37,11 @@ Backend -
- -
+ diff --git a/addons/point_of_sale/static/src/js/ChromeWidgets/HeaderButton.js b/addons/point_of_sale/static/src/js/ChromeWidgets/HeaderButton.js deleted file mode 100644 index bdb6847a43f..00000000000 --- a/addons/point_of_sale/static/src/js/ChromeWidgets/HeaderButton.js +++ /dev/null @@ -1,23 +0,0 @@ -/** @odoo-module */ - -import { useService } from "@web/core/utils/hooks"; -import { ClosePosPopup } from "@point_of_sale/js/Popups/ClosePosPopup"; -import { Component } from "@odoo/owl"; -import { usePos } from "@point_of_sale/app/pos_hook"; - -// Previously HeaderButtonWidget -// This is the close session button -export class HeaderButton extends Component { - static template = "HeaderButton"; - - setup() { - super.setup(...arguments); - this.pos = usePos(); - this.popup = useService("popup"); - } - - async onClick() { - const info = await this.pos.globalState.getClosePosInfo(); - this.popup.add(ClosePosPopup, { info: info, keepBehind: true }); - } -} diff --git a/addons/point_of_sale/static/src/xml/ChromeWidgets/HeaderButton.xml b/addons/point_of_sale/static/src/xml/ChromeWidgets/HeaderButton.xml deleted file mode 100644 index df358d34545..00000000000 --- a/addons/point_of_sale/static/src/xml/ChromeWidgets/HeaderButton.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/addons/point_of_sale/static/tests/tours/acceptance_tour.js b/addons/point_of_sale/static/tests/tours/acceptance_tour.js index 440f20872b3..4acc5fb22e0 100644 --- a/addons/point_of_sale/static/tests/tours/acceptance_tour.js +++ b/addons/point_of_sale/static/tests/tours/acceptance_tour.js @@ -309,7 +309,7 @@ steps = steps.concat([ }, { content: "open closing the Point of Sale frontend popup", - trigger: ".header-button", + trigger: ".close-button", }, { content: "close the Point of Sale frontend", diff --git a/addons/point_of_sale/static/tests/tours/helpers/ProductScreenTourMethods.js b/addons/point_of_sale/static/tests/tours/helpers/ProductScreenTourMethods.js index f0ca4decd58..cef145ec4a0 100644 --- a/addons/point_of_sale/static/tests/tours/helpers/ProductScreenTourMethods.js +++ b/addons/point_of_sale/static/tests/tours/helpers/ProductScreenTourMethods.js @@ -255,7 +255,7 @@ class Do { clickCloseButton() { return [ { - trigger: ".header-button", + trigger: ".close-button", }, ]; } @@ -415,7 +415,7 @@ class Check { }, { content: "Click close session button", - trigger: ".header-button", + trigger: ".close-button", }, { content: "Check closing details", diff --git a/addons/point_of_sale/static/tests/tours/pricelist_tour.js b/addons/point_of_sale/static/tests/tours/pricelist_tour.js index bc1f24c621d..2496155b26f 100644 --- a/addons/point_of_sale/static/tests/tours/pricelist_tour.js +++ b/addons/point_of_sale/static/tests/tours/pricelist_tour.js @@ -319,7 +319,7 @@ steps = steps.concat([ }, { content: "confirm closing the frontend", - trigger: ".header-button", + trigger: ".close-button", run: function () {}, //it's a check, }, ]); diff --git a/addons/pos_hr/static/src/app/navbar.xml b/addons/pos_hr/static/src/app/navbar.xml index 313d8e4dbdb..5cad81459e7 100644 --- a/addons/pos_hr/static/src/app/navbar.xml +++ b/addons/pos_hr/static/src/app/navbar.xml @@ -8,7 +8,7 @@ - + !pos.globalState.config.module_pos_hr or pos.globalState.get_cashier().role === 'manager' or pos.globalState.get_cashier_user_id() === pos.globalState.user.id