Skip to content

Commit f6e9034

Browse files
committed
[FIX] pos_hr: initialize employeeBuffer before super call to avoid error
Steps to reproduce: =================== - Enable Login with Employee in POS settings - Open POS and log in with employee - Turn off the internet connection - Reload the POS page Issue: ====== - POS crashes with the following error: TypeError: Cannot read properties of undefined (reading push) - At that point, employeeBuffer is still undefined Cause: ====== - The method set_cashier() is triggered during the parent setup() - employeeBuffer was only initialized after super.setup() - In offline mode, this sequence still executes, leading to an exception when trying to .push() into an undefined buffer Fix: ==== - Moved the initialization of employeeBuffer to the beginning of the setup() method Task: 4850543 Runbot Error: 227777 closes odoo#216843 Signed-off-by: David Monnom (moda) <moda@odoo.com>
1 parent d985f8f commit f6e9034

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

addons/pos_hr/static/src/overrides/models/pos_store.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import { browser } from "@web/core/browser/browser";
44

55
patch(PosStore.prototype, {
66
async setup() {
7+
this.employeeBuffer = [];
78
await super.setup(...arguments);
89
if (this.config.module_pos_hr) {
910
this.login = Boolean(odoo.from_backend) && !this.config.module_pos_hr;
1011
if (!this.hasLoggedIn) {
1112
this.showScreen("LoginScreen");
1213
}
1314
}
14-
this.employeeBuffer = [];
1515
browser.addEventListener("online", () => {
1616
this.employeeBuffer.forEach((employee) =>
1717
this.data.write("pos.session", [this.config.current_session_id.id], {

0 commit comments

Comments
 (0)