fix: move receipt printing before session closure to prevent IndexedDB invalid state errors
This commit is contained in:
parent
f31936291f
commit
382b3f7f8a
@ -96,6 +96,15 @@ patch(ClosePosPopup.prototype, {
|
|||||||
.filter((pm) => pm.type === "bank")
|
.filter((pm) => pm.type === "bank")
|
||||||
.map((pm) => [pm.id, this.getDifference(pm.id)]);
|
.map((pm) => [pm.id, this.getDifference(pm.id)]);
|
||||||
|
|
||||||
|
// ── Print BEFORE closing session on server ───────────────────────
|
||||||
|
// IMPORTANT: Must print here while IndexedDB is still fully open.
|
||||||
|
// After close_session_from_ui responds, the Odoo bus/sync detects
|
||||||
|
// the session state change and begins IDB teardown. Any OWL render
|
||||||
|
// or Logger.log call after that point throws:
|
||||||
|
// InvalidStateError: Failed to execute 'transaction' on
|
||||||
|
// 'IDBDatabase': The database connection is closing.
|
||||||
|
await this._printClosingReceipt(receiptData);
|
||||||
|
|
||||||
const response = await this.pos.data.call(
|
const response = await this.pos.data.call(
|
||||||
"pos.session",
|
"pos.session",
|
||||||
"close_session_from_ui",
|
"close_session_from_ui",
|
||||||
@ -114,9 +123,6 @@ patch(ClosePosPopup.prototype, {
|
|||||||
// Mark session closed locally
|
// Mark session closed locally
|
||||||
this.pos.session.state = "closed";
|
this.pos.session.state = "closed";
|
||||||
|
|
||||||
// ── Print BEFORE redirect ────────────────────────────────────────
|
|
||||||
await this._printClosingReceipt(receiptData);
|
|
||||||
|
|
||||||
// ── Navigate away ────────────────────────────────────────────────
|
// ── Navigate away ────────────────────────────────────────────────
|
||||||
this.pos.router.close();
|
this.pos.router.close();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user