[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) <jcb@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
This commit is contained in:
pedrambiria
2022-09-27 09:32:41 +02:00
parent 0cd2a8e1fe
commit c7b47f6e6a
+3 -1
View File
@@ -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;