[FIX] website_sale_lazy_loading: give the test products their shop order

Created in one batch, every product got the same website_sequence (MAX + 5,
read before the insert) and the shop breaks the tie by id desc, so the
listing came out backwards and the page assertions failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GitHub Copilot 2026-10-04 15:04:53 +02:00
parent 1960f40301
commit 9e05a279d7
Signed by: snt
GPG key ID: A9FD34930EADBE71

View file

@ -25,11 +25,16 @@ class TestLazyLoading(HttpCase):
cls.other_category = cls.env["product.public.category"].create( cls.other_category = cls.env["product.public.category"].create(
{"name": "Other Cat"} {"name": "Other Cat"}
) )
# An explicit website_sequence keeps the shop order equal to the
# creation order: in a batch create every product gets the same default
# (MAX + 5, read before the insert) and the shop breaks the tie by
# `id desc`, which would list them backwards.
cls.products = cls.env["product.template"].create( cls.products = cls.env["product.template"].create(
[ [
{ {
"name": "Lazy Product %02d" % index, "name": "Lazy Product %02d" % index,
"list_price": 10.0 + index, "list_price": 10.0 + index,
"website_sequence": index,
"is_published": True, "is_published": True,
"public_categ_ids": [(6, 0, cls.category.ids)], "public_categ_ids": [(6, 0, cls.category.ids)],
} }