diff --git a/addons/l10n_fr_pos_cert/static/src/js/Chrome.js b/addons/l10n_fr_pos_cert/static/src/js/Chrome.js index e281108858b..10a37002fcd 100644 --- a/addons/l10n_fr_pos_cert/static/src/js/Chrome.js +++ b/addons/l10n_fr_pos_cert/static/src/js/Chrome.js @@ -3,18 +3,21 @@ import { Chrome } from "@point_of_sale/js/Chrome"; import { patch } from "@web/core/utils/patch"; import { ClosePosPopup } from "@point_of_sale/js/Popups/ClosePosPopup"; +import { onMounted } from "@odoo/owl"; patch(Chrome.prototype, "l10n_fr_pos_cert.Chrome", { - async start() { - await this._super(...arguments); - if (this.env.pos.is_french_country() && this.env.pos.pos_session.start_at) { - const now = Date.now(); - const limitDate = new Date(this.env.pos.pos_session.start_at); - limitDate.setDate(limitDate.getDate() + 1); - if (limitDate.getTime() < now) { - const info = await this.env.pos.getClosePosInfo(); - this.popup.add(ClosePosPopup, { info }); + setup() { + this._super(...arguments); + onMounted(async () => { + if (this.env.pos.is_french_country() && this.env.pos.pos_session.start_at) { + const now = Date.now(); + const limitDate = new Date(this.env.pos.pos_session.start_at); + limitDate.setDate(limitDate.getDate() + 1); + if (limitDate.getTime() < now) { + const info = await this.env.pos.getClosePosInfo(); + this.popup.add(ClosePosPopup, { info }); + } } - } + }); }, }); diff --git a/addons/point_of_sale/static/src/app/customer_display_service.js b/addons/point_of_sale/static/src/app/customer_display_service.js index 27ae7a08f89..3bef83b4521 100644 --- a/addons/point_of_sale/static/src/app/customer_display_service.js +++ b/addons/point_of_sale/static/src/app/customer_display_service.js @@ -104,46 +104,23 @@ export const customerDisplayService = { start(env, deps) { const { globalState } = deps.pos; - // Dummy service, does nothing until the globalState is ready, then the methods get replaced - const service = { - connect() {}, - }; + const { + iface_customer_facing_display: enabled, + iface_customer_facing_display_via_proxy: proxy, + } = globalState.config; + if (!enabled) { + return; + } - globalState.ready.then(() => { - const { - iface_customer_facing_display: enabled, - iface_customer_facing_display_local: local, - iface_customer_facing_display_via_proxy: proxy, - } = globalState.config; - if (!enabled) { - return; - } - - let display; - if (local) { - display = new LocalDisplay(globalState); - } else if (proxy) { - display = new RemoteDisplay( - globalState, - pick(deps, ...RemoteDisplay.serviceDependencies) - ); - } else { - // FIXME POSREF can this ever happen? - return; - } - // FIXME POSREF this is very inelegant. There are a lot of places that get more complicated - // because we want to mount the chrome before the globalState is loaded. Maybe we should - // just make the loading screen its own thing that doesn't depend on anything, instead - // of having it be a part of the chrome and having to propagate complexity everywhere. - env.services.customer_display = display; - // Register an effect to update the display automatically when anything it renders changes - effect( - batched((display) => display.update()), - [display] - ); - }); - - return service; + const display = proxy + ? new RemoteDisplay(globalState, pick(deps, ...RemoteDisplay.serviceDependencies)) + : new LocalDisplay(globalState); + // Register an effect to update the display automatically when anything it renders changes + effect( + batched((display) => display.update()), + [display] + ); + return display; }, }; diff --git a/addons/point_of_sale/static/src/app/debug/debug_service.js b/addons/point_of_sale/static/src/app/debug/debug_service.js index 1035c35644e..0a4d005d0f3 100644 --- a/addons/point_of_sale/static/src/app/debug/debug_service.js +++ b/addons/point_of_sale/static/src/app/debug/debug_service.js @@ -6,17 +6,14 @@ import { DebugWidget } from "./debug_widget"; import { withComputedProperties } from "@point_of_sale/utils"; const debugService = { - dependencies: ["pos"], /** * @param {{ debug: string }} env - * @param {object} deps - * @param {import("@point_of_sale/app/pos_store").PosStore} deps.pos */ - start(env, { pos }) { + start(env) { const internalState = reactive({ widgetOpen: true }); - const state = withComputedProperties(reactive({}), [internalState, pos], { - showWidget(internalState, pos) { - return env.debug && pos.uiState === "READY" && internalState.widgetOpen; + const state = withComputedProperties(reactive({}), [internalState], { + showWidget(internalState) { + return env.debug && internalState.widgetOpen; }, }); registry.category("main_components").add("DebugWidget", { diff --git a/addons/point_of_sale/static/src/app/loader/loader.js b/addons/point_of_sale/static/src/app/loader/loader.js new file mode 100644 index 00000000000..e3900a1c8a8 --- /dev/null +++ b/addons/point_of_sale/static/src/app/loader/loader.js @@ -0,0 +1,21 @@ +/** @odoo-module */ + +import { Component, useEffect } from "@odoo/owl"; + +export class Loader extends Component { + static template = "point_of_sale.Loader"; + static props = { loader: { type: Object, shape: { isShown: Boolean } } }; + setup() { + useEffect( + (isShown) => { + if (!isShown) { + // Destroy the loader app after it has faded out + setTimeout(() => { + this.__owl__.app.destroy(); + }, 1000); + } + }, + () => [this.props.loader.isShown] + ); + } +} diff --git a/addons/point_of_sale/static/src/app/loader/loader.scss b/addons/point_of_sale/static/src/app/loader/loader.scss new file mode 100644 index 00000000000..68f327ee320 --- /dev/null +++ b/addons/point_of_sale/static/src/app/loader/loader.scss @@ -0,0 +1,101 @@ +.pos-loader { + background-color: #222; + position: absolute; + left: 0px; + top: 0px; + width: 100%; + height: 100%; + z-index: 100001; // 1 more than the debug widget... + text-align: center; + font-family: Lato; + color: $gray-700; + transition: opacity 0.8s; + + .loader-feedback { + width: 400px; + height: 160px; + margin: -60px -200px; + position: absolute; + left: 50%; + top: 50%; + text-align: center; + } + + h1 { + font-weight: 300; + } + + .button { + display: inline-block; + margin: 25px auto; + line-height: 42px; + padding: 0px 16px; + font-size: 20px; + font-weight: 300; + border: solid 1px; + border-radius: 5px; + cursor: pointer; + + :active { + color: #222; + background: $gray-700; + } + } +} + +// loader animation +.lds-ellipsis { + display: inline-block; + position: relative; + width: 80px; + height: 60px; +} +.lds-ellipsis div { + position: absolute; + top: 33px; + width: 13px; + height: 13px; + border-radius: 50%; + background: #fff; + animation-timing-function: cubic-bezier(0, 1, 1, 0); +} +.lds-ellipsis div:nth-child(1) { + left: 8px; + animation: lds-ellipsis1 0.6s infinite; +} +.lds-ellipsis div:nth-child(2) { + left: 8px; + animation: lds-ellipsis2 0.6s infinite; +} +.lds-ellipsis div:nth-child(3) { + left: 32px; + animation: lds-ellipsis2 0.6s infinite; +} +.lds-ellipsis div:nth-child(4) { + left: 56px; + animation: lds-ellipsis3 0.6s infinite; +} +@keyframes lds-ellipsis1 { + 0% { + transform: scale(0); + } + 100% { + transform: scale(1); + } +} +@keyframes lds-ellipsis3 { + 0% { + transform: scale(1); + } + 100% { + transform: scale(0); + } +} +@keyframes lds-ellipsis2 { + 0% { + transform: translate(0, 0); + } + 100% { + transform: translate(24px, 0); + } +} diff --git a/addons/point_of_sale/static/src/app/loader/loader.xml b/addons/point_of_sale/static/src/app/loader/loader.xml new file mode 100644 index 00000000000..19b1e51a3b3 --- /dev/null +++ b/addons/point_of_sale/static/src/app/loader/loader.xml @@ -0,0 +1,14 @@ + + +
+
+ +
+ + +

Connecting to devices

+
+
+
+
+
diff --git a/addons/point_of_sale/static/src/app/pos_store.js b/addons/point_of_sale/static/src/app/pos_store.js index 748d3429631..739eb120e61 100644 --- a/addons/point_of_sale/static/src/app/pos_store.js +++ b/addons/point_of_sale/static/src/app/pos_store.js @@ -11,8 +11,6 @@ import { CashOpeningPopup } from "@point_of_sale/js/Popups/CashOpeningPopup"; import { sprintf } from "@web/core/utils/strings"; export class PosStore extends Reactive { - /** @type {'LOADING' | 'READY' | 'CLOSING'} */ - uiState = "LOADING"; hasBigScrollBars = false; loadingSkipButtonIsShown = false; mainScreen = { name: null, component: null }; @@ -27,10 +25,10 @@ export class PosStore extends Reactive { ]; constructor() { super(); - this.setup(...arguments); + this.ready = this.setup(...arguments).then(() => this); } // use setup instead of constructor because setup can be patched. - setup(env, { popup, orm, number_buffer, hardware_proxy, barcode_reader }) { + async setup(env, { popup, orm, number_buffer, hardware_proxy, barcode_reader }) { this.orm = orm; this.popup = popup; this.numberBuffer = number_buffer; @@ -40,6 +38,13 @@ export class PosStore extends Reactive { // FIXME POSREF: the hardwareProxy needs the pos and the pos needs the hardwareProxy. Maybe // the hardware proxy should just be part of the pos service? this.hardwareProxy.pos = this.globalState; + await this.globalState.load_server_data(); + if (this.globalState.config.use_proxy) { + await this.connectToProxy(); + } + this.closeOtherTabs(); + this.preloadImages(); + this.showScreen("ProductScreen"); } showScreen(name, props) { @@ -126,9 +131,6 @@ export class PosStore extends Reactive { body: reason, }); if (confirmed) { - // FIXME POSREF setting the location prevents the next render, the loading screen never shows - this.globalState.uiState = "CLOSING"; - this.globalState.loadingSkipButtonIsShown = false; window.location = "/web#action=point_of_sale.action_client_pos_menu"; } } @@ -209,12 +211,57 @@ export class PosStore extends Reactive { this.globalState.pos_session.state == "opening_control" ); } + + preloadImages() { + for (const product of this.globalState.db.get_product_by_category(0)) { + const image = new Image(); + image.src = `/web/image?model=product.product&field=image_128&id=${product.id}&unique=${product.write_date}`; + } + for (const category of Object.values(this.globalState.db.category_by_id)) { + if (category.id == 0) { + continue; + } + const image = new Image(); + image.src = `/web/image?model=pos.category&field=image_128&id=${category.id}&unique=${category.write_date}`; + } + const image = new Image(); + image.src = "/point_of_sale/static/src/img/backspace.png"; + } + + /** + * Close other tabs that contain the same pos session. + */ + closeOtherTabs() { + // FIXME POSREF use the bus? + localStorage["message"] = ""; + localStorage["message"] = JSON.stringify({ + message: "close_tabs", + session: this.globalState.pos_session.id, + }); + + window.addEventListener( + "storage", + (event) => { + if (event.key === "message" && event.newValue) { + const msg = JSON.parse(event.newValue); + if ( + msg.message === "close_tabs" && + msg.session == this.globalState.pos_session.id + ) { + console.info("POS / Session opened in another window. EXITING POS"); + this.closePos(); + } + } + }, + false + ); + } } export const posService = { dependencies: PosStore.serviceDependencies, - start(env, deps) { - return new PosStore(env, deps); + async start(env, deps) { + return new PosStore(env, deps).ready; }, }; diff --git a/addons/point_of_sale/static/src/entry/main.js b/addons/point_of_sale/static/src/entry/main.js index 512214219bc..bd59f3fdb3e 100644 --- a/addons/point_of_sale/static/src/entry/main.js +++ b/addons/point_of_sale/static/src/entry/main.js @@ -2,9 +2,16 @@ import { startWebClient } from "@web/start"; import { Chrome } from "@point_of_sale/js/Chrome"; +import { Loader } from "@point_of_sale/app/loader/loader"; +import { templates } from "@web/core/assets"; +import { mount, reactive, whenReady } from "@odoo/owl"; +import { _t } from "@web/core/l10n/translation"; -// FIXME POSREF no we shouldn't but if we did nothing should react, if it does it shouldn't be loaded -// For consistency's sake, we should trigger"WEB_CLIENT_READY" on the bus when PosApp is mounted -// But we can't since mail and some other poll react on that cue, and we don't want those services started -// FIXME POSREF stop using startWebclient: this is not a web client. -startWebClient(Chrome); +const loader = reactive({ isShown: true }); +whenReady(() => { + // Show loader as soon as the page is ready, do not wait for services to be started + // as some services load data over RPC and this is why we want to show a loader. + mount(Loader, document.body, { templates, translateFn: _t, props: { loader } }); +}); +// FIXME POSREF stop using startWebclient?: this is not a web client. +startWebClient(Chrome, { disableLoader: () => (loader.isShown = false) }); diff --git a/addons/point_of_sale/static/src/img/bc-arrow-big.png b/addons/point_of_sale/static/src/img/bc-arrow-big.png deleted file mode 100644 index f845fe6837d..00000000000 Binary files a/addons/point_of_sale/static/src/img/bc-arrow-big.png and /dev/null differ diff --git a/addons/point_of_sale/static/src/js/Chrome.js b/addons/point_of_sale/static/src/js/Chrome.js index d98d104cc4c..dce34977ad0 100644 --- a/addons/point_of_sale/static/src/js/Chrome.js +++ b/addons/point_of_sale/static/src/js/Chrome.js @@ -8,7 +8,14 @@ import { MainComponentsContainer } from "@web/core/main_components_container"; import { ErrorHandler } from "@web/core/utils/components"; import { Navbar } from "@point_of_sale/app/navbar/navbar"; import { usePos } from "@point_of_sale/app/pos_hook"; -import { useExternalListener, useSubEnv, reactive, onWillUnmount, Component } from "@odoo/owl"; +import { + useExternalListener, + useSubEnv, + reactive, + onWillUnmount, + Component, + onMounted, +} from "@odoo/owl"; /** * Chrome is the root component of the PoS App. @@ -16,6 +23,7 @@ import { useExternalListener, useSubEnv, reactive, onWillUnmount, Component } fr export class Chrome extends Component { static template = "Chrome"; // FIXME POSREF namespace templates static components = { Transition, MainComponentsContainer, ErrorHandler, Navbar }; + static props = { disableLoader: Function }; setup() { this.pos = usePos(); this.popup = useService("popup"); @@ -51,88 +59,11 @@ export class Chrome extends Component { } }); - // This is not done in onWillStart because we want to show the loader immediately - this.start(); - } - async start() { - await this.pos.globalState.load_server_data(); - if (this.pos.globalState.config.use_proxy) { - await this.pos.connectToProxy(); - } - this._closeOtherTabs(); - this.pos.uiState = "READY"; - const { name, props } = this.startScreen; - this.pos.showScreen(name, props); - this.runBackgroundTasks(); + onMounted(this.props.disableLoader); } // GETTERS // - /** - * Startup screen can be based on pos config so the startup screen - * is only determined after pos data is completely loaded. - */ - get startScreen() { - return { name: "ProductScreen" }; - } - - // CONTROL METHODS // - - runBackgroundTasks() { - // push order in the background, no need to await - this.pos.globalState.push_orders(); - // Allow using the app even if not all the images are loaded. - // Basically, preload the images in the background. - this._preloadImages(); - } - - // MISC METHODS // - _preloadImages() { - for (const product of this.pos.globalState.db.get_product_by_category(0)) { - const image = new Image(); - image.src = `/web/image?model=product.product&field=image_128&id=${product.id}&unique=${product.write_date}`; - } - for (const category of Object.values(this.pos.globalState.db.category_by_id)) { - if (category.id == 0) { - continue; - } - const image = new Image(); - image.src = `/web/image?model=pos.category&field=image_128&id=${category.id}&unique=${category.write_date}`; - } - const staticImages = ["backspace.png", "bc-arrow-big.png"]; - for (const imageName of staticImages) { - const image = new Image(); - image.src = `/point_of_sale/static/src/img/${imageName}`; - } - } - /** - * Close other tabs that contain the same pos session. - */ - _closeOtherTabs() { - // FIXME POSREF use the bus? - localStorage["message"] = ""; - localStorage["message"] = JSON.stringify({ - message: "close_tabs", - session: this.pos.globalState.pos_session.id, - }); - - window.addEventListener( - "storage", - (event) => { - if (event.key === "message" && event.newValue) { - const msg = JSON.parse(event.newValue); - if ( - msg.message === "close_tabs" && - msg.session == this.pos.globalState.pos_session.id - ) { - console.info("POS / Session opened in another window. EXITING POS"); - this.pos.closePos(); - } - } - }, - false - ); - } get showCashMoveButton() { return Boolean(this.pos.globalState?.config?.cash_control); } diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 54e0c973a3a..8ed0cf49220 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -231,6 +231,8 @@ export class PosGlobalState extends PosModel { const { start_category, iface_start_categ_id } = this.config; this.selectedCategoryId = (start_category && iface_start_categ_id?.[0]) || 0; this.hasBigScrollBars = this.config.iface_big_scrollbars; + // Push orders in background, do not await + this.push_orders(); this.markReady(); } diff --git a/addons/point_of_sale/static/src/scss/pos.scss b/addons/point_of_sale/static/src/scss/pos.scss index c11374ed1d6..4cf75ed1545 100644 --- a/addons/point_of_sale/static/src/scss/pos.scss +++ b/addons/point_of_sale/static/src/scss/pos.scss @@ -145,57 +145,6 @@ td { overflow: hidden; } -/* ********* The black loading screen ********* */ - -.pos .loader{ - background-color: #222; - position:absolute; - left:0px; - top:0px; - width:100%; - height:100%; - z-index: 999; - text-align: center; - font-family: Lato; - color: $gray-700; -} - -.pos .loader-feedback{ - width: 400px; - height: 160px; - margin: -60px -200px; - position: absolute; - left: 50%; top: 50%; - text-align: center; -} -.pos .loader-feedback h1{ - font-weight: 300; -} -.pos .loader-feedback .progressbar{ - background: rgb(73,73,73); - height: 1px; -} -.pos .loader-feedback .progressbar > .progress{ - height: 100%; - background: white; - width: 0%; - box-shadow: 0px 0px 5px rgba(255,255,255,0.35); -} -.pos .loader-feedback .button{ - display: inline-block; - margin: 25px auto; - line-height: 42px; - padding: 0px 16px; - font-size: 20px; - font-weight: 300; - border: solid 1px; - border-radius: 5px; - cursor: pointer; -} -.pos .loader-feedback .button:active{ - color: #222; - background: $gray-700; -} /* ********* Generic Layout Constructs ********* */ .pos .window{ @@ -2921,14 +2870,6 @@ td { opacity: 0; } -.o-swing { - transition: opacity 0.8s; -} - -.o-swing-enter, .o-swing-leave { - opacity: 0; -} - /* We block the top-header when a temp screen is displayed. Similar to blocking the whole ui when a popup is displayed. @@ -3736,64 +3677,6 @@ td { } } -/* For LoadingScreen */ - -.lds-ellipsis { - display: inline-block; - position: relative; - width: 80px; - height: 60px; -} -.lds-ellipsis div { - position: absolute; - top: 33px; - width: 13px; - height: 13px; - border-radius: 50%; - background: #fff; - animation-timing-function: cubic-bezier(0, 1, 1, 0); -} -.lds-ellipsis div:nth-child(1) { - left: 8px; - animation: lds-ellipsis1 0.6s infinite; -} -.lds-ellipsis div:nth-child(2) { - left: 8px; - animation: lds-ellipsis2 0.6s infinite; -} -.lds-ellipsis div:nth-child(3) { - left: 32px; - animation: lds-ellipsis2 0.6s infinite; -} -.lds-ellipsis div:nth-child(4) { - left: 56px; - animation: lds-ellipsis3 0.6s infinite; -} -@keyframes lds-ellipsis1 { - 0% { - transform: scale(0); - } - 100% { - transform: scale(1); - } -} -@keyframes lds-ellipsis3 { - 0% { - transform: scale(1); - } - 100% { - transform: scale(0); - } -} -@keyframes lds-ellipsis2 { - 0% { - transform: translate(0, 0); - } - 100% { - transform: translate(24px, 0); - } -} - .menu { color: white; z-index: 1000; diff --git a/addons/point_of_sale/static/src/xml/Chrome.xml b/addons/point_of_sale/static/src/xml/Chrome.xml index e20bbdc9b41..e6d0013ba89 100644 --- a/addons/point_of_sale/static/src/xml/Chrome.xml +++ b/addons/point_of_sale/static/src/xml/Chrome.xml @@ -4,39 +4,24 @@
- - -
-
-
-
-
- - - - - - -
+ +
+
+
+
+
+ + + + +
- - - -
-
- -
- -

Connecting to devices

-
-
-
-
+
diff --git a/addons/point_of_sale/static/tests/unit/pos_app_tests.js b/addons/point_of_sale/static/tests/unit/pos_app_tests.js index 163e699aec6..b8d51f384d8 100644 --- a/addons/point_of_sale/static/tests/unit/pos_app_tests.js +++ b/addons/point_of_sale/static/tests/unit/pos_app_tests.js @@ -1,6 +1,6 @@ /** @odoo-module */ import { Chrome } from "@point_of_sale/js/Chrome"; -import { getFixture, mount, nextTick } from "@web/../tests/helpers/utils"; +import { getFixture, mount } from "@web/../tests/helpers/utils"; import { makeTestEnv } from "@web/../tests/helpers/mock_env"; import { registry } from "@web/core/registry"; import { posService } from "@point_of_sale/app/pos_store"; @@ -46,11 +46,12 @@ const serverData = { QUnit.test("mount the Chrome", async (assert) => { const fixture = getFixture(); - const root = await mount(Chrome, fixture, { + assert.verifySteps([]); + await mount(Chrome, fixture, { env: await makeTestEnv({ serverData }), test: true, + props: { disableLoader: () => assert.step("disable loader") }, }); - await root.env.services.pos.globalState.ready; - await nextTick(); assert.containsOnce(fixture, ".pos"); + assert.verifySteps(["disable loader"]); }); diff --git a/addons/pos_hr/static/src/app/pos_store.js b/addons/pos_hr/static/src/app/pos_store.js index 43acf1d2637..c97f7a5e68a 100644 --- a/addons/pos_hr/static/src/app/pos_store.js +++ b/addons/pos_hr/static/src/app/pos_store.js @@ -4,6 +4,12 @@ import { patch } from "@web/core/utils/patch"; import { PosStore } from "@point_of_sale/app/pos_store"; patch(PosStore.prototype, "pos_hr.PosStore", { + async setup() { + await this._super(...arguments); + if (this.globalState.config.module_pos_hr) { + this.showTempScreen("LoginScreen"); + } + }, /** * @override */ diff --git a/addons/pos_hr/static/src/js/Chrome.js b/addons/pos_hr/static/src/js/Chrome.js index 3a469eeae7e..a4ed3088905 100644 --- a/addons/pos_hr/static/src/js/Chrome.js +++ b/addons/pos_hr/static/src/js/Chrome.js @@ -4,12 +4,6 @@ import { Chrome } from "@point_of_sale/js/Chrome"; import { patch } from "@web/core/utils/patch"; patch(Chrome.prototype, "pos_hr.Chrome", { - async start() { - await this._super(...arguments); - if (this.env.pos.config.module_pos_hr) { - this.pos.showTempScreen("LoginScreen"); // FIXME POSREF: use startScreen instead. - } - }, get showCashMoveButton() { return ( this._super(...arguments) && diff --git a/addons/pos_restaurant/static/src/app/pos_store.js b/addons/pos_restaurant/static/src/app/pos_store.js index 89060c2eb30..68eb778af4f 100644 --- a/addons/pos_restaurant/static/src/app/pos_store.js +++ b/addons/pos_restaurant/static/src/app/pos_store.js @@ -24,13 +24,12 @@ patch(PosStore.prototype, "pos_restaurant.PosStore", { /** * @override */ - setup() { - this._super(...arguments); - this.globalState.ready.then(() => { - if (this.globalState.config.is_table_management) { - this.setActivityListeners(); - } - }); + async setup() { + await this._super(...arguments); + if (this.globalState.config.is_table_management) { + this.setActivityListeners(); + this.showScreen("FloorScreen", { floor: this.globalState.table?.floor || null }); + } }, setActivityListeners() { IDLE_TIMER_SETTER = this.setIdleTimer.bind(this); diff --git a/addons/pos_restaurant/static/src/js/Chrome.js b/addons/pos_restaurant/static/src/js/Chrome.js deleted file mode 100644 index 27f988fb1ab..00000000000 --- a/addons/pos_restaurant/static/src/js/Chrome.js +++ /dev/null @@ -1,20 +0,0 @@ -/** @odoo-module */ - -import { patch } from "@web/core/utils/patch"; -import { Chrome } from "@point_of_sale/js/Chrome"; - -patch(Chrome.prototype, "pos_restaurant.Chrome", { - /** - * @override - * FIXME POSREF move to pos store - * `FloorScreen` is the start screen if there are floors. - */ - get startScreen() { - if (this.env.pos.config.is_table_management) { - const table = this.env.pos.table; - return { name: "FloorScreen", props: { floor: table ? table.floor : null } }; - } else { - return this._super(...arguments); - } - }, -}); diff --git a/addons/pos_restaurant/static/src/js/Screens/TicketScreen.js b/addons/pos_restaurant/static/src/js/Screens/TicketScreen.js index 32b1c8a5102..f5e5cfcde13 100644 --- a/addons/pos_restaurant/static/src/js/Screens/TicketScreen.js +++ b/addons/pos_restaurant/static/src/js/Screens/TicketScreen.js @@ -83,11 +83,7 @@ patch(TicketScreen.prototype, "pos_restaurant.TicketScreen", { if (this.env.pos.config.is_table_management) { this.env.pos.setOrderToRemove(order); if (!this.env.pos.table) { - try { - await this.env.pos._removeOrdersFromServer(); - } catch (error) { - throw error; - } + await this.env.pos._removeOrdersFromServer(); } } await _super(...arguments); diff --git a/addons/web/static/src/start.js b/addons/web/static/src/start.js index 678d756571c..48515d5b031 100644 --- a/addons/web/static/src/start.js +++ b/addons/web/static/src/start.js @@ -19,7 +19,7 @@ import { App, whenReady } from "@odoo/owl"; * * @param {Component} Webclient */ -export async function startWebClient(Webclient) { +export async function startWebClient(Webclient, props = {}) { odoo.info = { db: session.db, server_version: session.server_version, @@ -39,6 +39,7 @@ export async function startWebClient(Webclient) { const app = new App(Webclient, { name: "Odoo Web Client", env, + props, templates, dev: env.debug, warnIfNoStaticProps: true,