[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:
parent
5efe57dc19
commit
89c008441e
13 changed files with 1354 additions and 58 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -102,13 +102,16 @@ class TestTemplatesRendering(TransactionCase):
|
|||
- day_names MUST be passed from controller context
|
||||
- day_names MUST NOT be defined with _() inside t-value attributes
|
||||
- Templates use day_names[index] from context, not t-set with _()
|
||||
|
||||
Note: day_names can be used in called sub-templates (t-call), not just the main template.
|
||||
We verify the sub-template that actually uses day_names (eskaera_order_card_meta).
|
||||
"""
|
||||
template = self.env.ref("website_sale_aplicoop.eskaera_page")
|
||||
# Read the template source to verify it doesn't have inline _() in t-value
|
||||
# Verify that the sub-template that uses day_names is properly structured
|
||||
template = self.env.ref("website_sale_aplicoop.eskaera_order_card_meta")
|
||||
self.assertIn(
|
||||
"day_names",
|
||||
template.arch_db,
|
||||
"Template must reference day_names from context",
|
||||
"Sub-template eskaera_order_card_meta must reference day_names from context",
|
||||
)
|
||||
# The fix ensures no <t t-set="day_names" t-value="[_(...)]"/> exists
|
||||
# which was causing the NoneType error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue