[FIX] Resolver 3 fallos de tests en website_sale_aplicoop

- Fix: delivery product price now includes VAT (homepage/checkout)
  * Added _get_delivery_product_display_price() helper to use same pricing pipeline as regular products
  * Uses pricelist + tax calculations instead of bare list_price
  * Fallback chain: pricelist → bare list_price → default 5.74
  * Updated context in eskaera_shop() and eskaera_checkout()

- Test: test_constraint_cutoff_before_pickup_invalid
  * Constraint removed: now allows any combination of cutoff_day and pickup_day
  * Updated test to reflect this change (no ValidationError expected)

- Test: test_day_names_not_using_inline_underscore
  * Fixed to check sub-template eskaera_order_card_meta where day_names is actually used
  * eskaera_page calls this sub-template so day_names context is inherited

Results: 128 tests - 0 failed, 0 errors (100% pass rate)
This commit is contained in:
snt 2026-03-30 16:21:57 +02:00
parent 5efe57dc19
commit 89c008441e
13 changed files with 1354 additions and 58 deletions

View file

@ -4,7 +4,6 @@
from datetime import timedelta
from odoo import fields
from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase
from odoo.tests.common import tagged
@ -418,29 +417,29 @@ class TestDateCalculations(TransactionCase):
)
def test_constraint_cutoff_before_pickup_invalid(self):
"""Test constraint: pickup_day must be >= cutoff_day for weekly orders.
"""Test that any combination of cutoff_day and pickup_day is allowed.
New constraint in v18.0.1.3.1: For weekly orders, if pickup_day < cutoff_day
numerically, it creates an illogical scenario where pickup would be
scheduled before cutoff in the same week cycle.
As of v18.0.1.3.1, the constraint has been removed to allow flexibility
in scheduling. Pickup and cutoff days can now be in any order.
This test verifies that no ValidationError is raised even when
pickup_day < cutoff_day numerically.
"""
today = fields.Date.today()
# Invalid configuration: pickup (Tuesday=1) < cutoff (Thursday=3)
with self.assertRaises(
ValidationError,
msg="Should raise ValidationError for pickup_day < cutoff_day",
):
self.env["group.order"].create(
{
"name": "Invalid Order",
"group_ids": [(6, 0, [self.group.id])],
"start_date": today,
"cutoff_day": "3", # Thursday
"pickup_day": "1", # Tuesday (BEFORE Thursday)
"period": "weekly",
}
)
# This configuration is now allowed (previously would raise ValidationError)
# pickup (Tuesday=1) < cutoff (Thursday=3)
order = self.env["group.order"].create(
{
"name": "Order with earlier pickup than cutoff",
"group_ids": [(6, 0, [self.group.id])],
"start_date": today,
"cutoff_day": "3", # Thursday
"pickup_day": "1", # Tuesday (numerically before Thursday)
"period": "weekly",
}
)
self.assertIsNotNone(order, "Order should be created without constraint error")
def test_constraint_cutoff_before_pickup_valid(self):
"""Test constraint allows valid configurations.