Skip to content
Snippets Groups Projects
Commit 51ac0092 authored by stcc-odoo's avatar stcc-odoo
Browse files

[FIX] website_sale: make website_sequence unique


Steps to reproduce:

- Install website_sale
- Go to website shop in the frontend
	- Login, Edit
	- Click on 3rd or 4th kanban item
	- Push down

Issue:

The item goes to the end of the list instead of moving one element to
the right/down. Pushing an element down searches for the next element
with a higher `website_sequence` and places the current element right
after, by switching their sequence values.

Normally the logic works fine, but the problem arises when the
`website_sale` module is installed, when records with
`website_sequence = NULL` are set to the same default value, namely
10000. Then, when an item with `website_sequence = 10000` is pushed
down, it will skip many items, before finding one with a higher
`website_sequence`.

Solution:

When updating records with `website_sequence = NULL`, assign an unique
sequence to each one. We can set the `website_sequence` relative to the
inverse of the id to ensure that the order on the shopping page remains
the same as it was prior to the fix.

opw-3318867

closes odoo/odoo#127982

Signed-off-by: default avatarStefan-Calin Crainiciuc (stcc) <stcc@odoo.com>
parent 82b1e68b
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment