From 2e3e1ab71de309830788d2a8c4c97c95d7e8b66b Mon Sep 17 00:00:00 2001 From: "Jacky (trj)" Date: Mon, 23 May 2022 11:18:09 +0000 Subject: [PATCH] [FIX] point_of_sale,pos_restaurant: fix auto FloorScreen when idle - Restaurant shops should automatically go back to floor screen when idle. However, after https://github.com/odoo/odoo/pull/89712, this feature is broken when pos_hr is also installed - the screen doesn't automatically go back to floor screen. A simple fix is to clear the tempScreen name when the shown tempScreen is closed. Note that this change is fine because when tempScreen is closed (!isShown), the `tempScreen.name` information has no use. - Once the `idleTimer` is set, it is never removed. This means that even if the conditions to go back to the FloorScreen at the current time T are not satisfied, the `_actionAfterIdle` is still run. Checking if the action can be done once triggered fix the issue. closes odoo/odoo#92177 X-original-commit: d77d7e90b8f437c012dea2da2ec01e59c14b34ff Signed-off-by: Joseph Caburnay (jcb) Signed-off-by: Trinh Jacky (trj) --- addons/point_of_sale/static/src/js/Chrome.js | 1 + addons/pos_restaurant/static/src/js/Chrome.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/addons/point_of_sale/static/src/js/Chrome.js b/addons/point_of_sale/static/src/js/Chrome.js index 872e75a86b3..a08ae001bfa 100644 --- a/addons/point_of_sale/static/src/js/Chrome.js +++ b/addons/point_of_sale/static/src/js/Chrome.js @@ -274,6 +274,7 @@ odoo.define('point_of_sale.Chrome', function(require) { } __closeTempScreen() { this.tempScreen.isShown = false; + this.tempScreen.name = null; } __showScreen({ detail: { name, props = {} } }) { const component = this.constructor.components[name]; diff --git a/addons/pos_restaurant/static/src/js/Chrome.js b/addons/pos_restaurant/static/src/js/Chrome.js index 5b9162d6837..45fcf4af684 100644 --- a/addons/pos_restaurant/static/src/js/Chrome.js +++ b/addons/pos_restaurant/static/src/js/Chrome.js @@ -53,6 +53,10 @@ odoo.define('pos_restaurant.chrome', function (require) { } } _actionAfterIdle() { + // We also need to check if the action still need to be triggered + if (!this._shouldResetIdleTimer()) { + return; + } if (this.tempScreen.isShown) { this.trigger('close-temp-screen'); }