From c7b47f6e6a8ea0361c627ebdcee47aa902ba434f Mon Sep 17 00:00:00 2001 From: pedrambiria Date: Fri, 16 Sep 2022 09:25:32 +0000 Subject: [PATCH] [FIX] point_of_sale: prevent sequence jump when loading the paid orders Before this commit: the order sequence jumped if the paid orders from previous sessions were loaded. Steps to reproduce the issue: 1. Open a POS session and create some orders 2. Close the session and open a new one 3. Open the ticket screen, and filter paid orders 4. Click the new order button => the sequence jumps equal to the number of loaded paid orders The solution is not to increase the sequence if it is loading the paid orders. opw-2979271 closes odoo/odoo#100906 X-original-commit: f948b2eb8273f28ba3a30307a626ec469c3625a2 Signed-off-by: Joseph Caburnay (jcb) Signed-off-by: Pedram Bi Ria (pebr) --- addons/point_of_sale/static/src/js/models.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index bc1c11f4e16..aaf8507be65 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -2329,7 +2329,9 @@ class Order extends PosModel { */ init_from_JSON(json) { let partner; - if (json.pos_session_id !== this.pos.pos_session.id) { + if (json.state && ['done', 'invoiced', 'paid'].includes(json.state)) { + this.sequence_number = json.sequence_number; + } else if (json.pos_session_id !== this.pos.pos_session.id) { this.sequence_number = this.pos.pos_session.sequence_number++; } else { this.sequence_number = json.sequence_number;