feat(website_sale_aplicoop): ordenar productos por website_sequence y nombre

- Ordena productos primero por website_sequence y luego alfabéticamente por nombre (case-insensitive)
- Fix test: cambiar tipo de producto de 'product' a 'consu' (Odoo 18 compatibility)
This commit is contained in:
snt 2026-02-25 19:34:49 +01:00
parent 3f822a28cf
commit 539cd5cccd
2 changed files with 6 additions and 5 deletions

View file

@ -477,7 +477,10 @@ class GroupOrder(models.Model):
len(products),
)
return products
# Sort products by website_sequence (primary) and name (secondary, case-insensitive)
return products.sorted(
lambda p: (p.product_tmpl_id.website_sequence, (p.name or "").lower())
)
def _get_products_paginated(self, order_id, page=1, per_page=20):
"""Get paginated products for a group order.

View file

@ -62,7 +62,7 @@ class TestPortalSaleOrderCreation(TransactionCase):
{
"name": "Test Product",
"list_price": 100.0,
"type": "product",
"type": "consu",
}
)
@ -117,9 +117,7 @@ class TestPortalSaleOrderCreation(TransactionCase):
)
# Child should fallback to commercial partner's salesperson
self.assertEqual(
child_partner.commercial_partner_id.user_id, self.salesperson
)
self.assertEqual(child_partner.commercial_partner_id.user_id, self.salesperson)
def test_portal_user_can_update_order_lines(self):
"""Test that portal users can update existing order lines with sudo()."""