summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormanv-afk <manv@odoo.com>2025-02-06 15:34:09 +0100
committermanv-afk <manv@odoo.com>2025-02-07 11:18:52 +0000
commitd99e44f22634ac589a940d85fab84ca2b2e85332 (patch)
tree954202b6fc152499bc4336056d8eeafa6761d9d1
parente55551591acf979bbea30b5d7376ab6a5d65f80d (diff)
[FIX] point_of_sale: loading ticket screen
This fix prevent blank screen (when offline) & inifinte loop (when in 3G or other low connection) on order screen. - **Offline Mode:** When accessing the order screen offline, now the screen loads previously fetched orders and displays a "Limited Functionality" popup. - **Slow Connection (3G):** Infinite loop (caused by repeated call to `await this.pos.getServerOrders()`) is fixed by ensuring orders load only once, even on slow connections using the flag `loadingOrderState` closes odoo/odoo#196810 Task-id: 4550978 Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
-rw-r--r--addons/point_of_sale/static/src/app/screens/ticket_screen/ticket_screen.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/addons/point_of_sale/static/src/app/screens/ticket_screen/ticket_screen.js b/addons/point_of_sale/static/src/app/screens/ticket_screen/ticket_screen.js
index 2e60145422f..1c4bba5060a 100644
--- a/addons/point_of_sale/static/src/app/screens/ticket_screen/ticket_screen.js
+++ b/addons/point_of_sale/static/src/app/screens/ticket_screen/ticket_screen.js
@@ -24,6 +24,7 @@ import { PosOrderLineRefund } from "@point_of_sale/app/models/pos_order_line_ref
import { fuzzyLookup } from "@web/core/utils/search";
import { parseUTCString } from "@point_of_sale/utils";
import { useTrackedAsync } from "@point_of_sale/app/utils/hooks";
+import { ConnectionLostError } from "@web/core/network/rpc";
const NBR_BY_PAGE = 30;
@@ -77,10 +78,16 @@ export class TicketScreen extends Component {
onMounted(this.onMounted);
onWillStart(async () => {
- if (this.pos._shouldLoadOrders()) {
+ if (this.pos._shouldLoadOrders() && !this.pos.loadingOrderState) {
try {
this.pos.setLoadingOrderState(true);
await this.pos.getServerOrders();
+ } catch (error) {
+ if (error instanceof ConnectionLostError) {
+ Promise.reject(error);
+ return error;
+ }
+ throw error;
} finally {
this.pos.setLoadingOrderState(false);
}