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:
parent
3f822a28cf
commit
539cd5cccd
2 changed files with 6 additions and 5 deletions
|
|
@ -477,7 +477,10 @@ class GroupOrder(models.Model):
|
||||||
len(products),
|
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):
|
def _get_products_paginated(self, order_id, page=1, per_page=20):
|
||||||
"""Get paginated products for a group order.
|
"""Get paginated products for a group order.
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class TestPortalSaleOrderCreation(TransactionCase):
|
||||||
{
|
{
|
||||||
"name": "Test Product",
|
"name": "Test Product",
|
||||||
"list_price": 100.0,
|
"list_price": 100.0,
|
||||||
"type": "product",
|
"type": "consu",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -117,9 +117,7 @@ class TestPortalSaleOrderCreation(TransactionCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Child should fallback to commercial partner's salesperson
|
# Child should fallback to commercial partner's salesperson
|
||||||
self.assertEqual(
|
self.assertEqual(child_partner.commercial_partner_id.user_id, self.salesperson)
|
||||||
child_partner.commercial_partner_id.user_id, self.salesperson
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_portal_user_can_update_order_lines(self):
|
def test_portal_user_can_update_order_lines(self):
|
||||||
"""Test that portal users can update existing order lines with sudo()."""
|
"""Test that portal users can update existing order lines with sudo()."""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue