[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) <jcb@odoo.com>
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
This commit is contained in:
Jacky (trj)
2022-05-24 16:00:26 +02:00
parent a1e8d116d5
commit 2e3e1ab71d
2 changed files with 5 additions and 0 deletions
@@ -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];
@@ -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');
}