[TEST] website_sale_aplicoop: add tests for home_delivery computed field
- New test_home_delivery.py: verifies group.order.home_delivery derives from delivery_product_id (compute), and that sale.order.home_delivery is set correctly through _get_effective_delivery_context - Fix test_save_order_endpoints: replace home_delivery=True (now ignored on computed field) with delivery_product_id to enable delivery - Fix test_phase3_confirm_eskaera: same fix for integration test setUp Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9d614ed79e
commit
a1899483c5
4 changed files with 257 additions and 4 deletions
|
|
@ -96,6 +96,15 @@ class TestSaveOrderEndpoints(TransactionCase):
|
|||
}
|
||||
)
|
||||
|
||||
# Delivery service product (required to enable home_delivery on group.order)
|
||||
self.delivery_product = self.env["product.product"].create(
|
||||
{
|
||||
"name": "Home Delivery Service",
|
||||
"type": "service",
|
||||
"list_price": 3.0,
|
||||
}
|
||||
)
|
||||
|
||||
# Associate product with group order
|
||||
self.group_order.product_ids = [(4, self.product.id)]
|
||||
|
||||
|
|
@ -206,7 +215,8 @@ class TestSaveOrderEndpoints(TransactionCase):
|
|||
|
||||
def test_save_eskaera_draft_propagates_home_delivery(self):
|
||||
"""Test that save_eskaera_draft() propagates home_delivery correctly."""
|
||||
# Create a group order with home_delivery=True
|
||||
# Create a group order with home delivery enabled via delivery_product_id
|
||||
# (home_delivery is a computed field derived from delivery_product_id)
|
||||
group_order_home = self.env["group.order"].create(
|
||||
{
|
||||
"name": "Test Group Order with Home Delivery",
|
||||
|
|
@ -217,7 +227,7 @@ class TestSaveOrderEndpoints(TransactionCase):
|
|||
"period": "weekly",
|
||||
"pickup_day": "3",
|
||||
"pickup_date": datetime.now().date() + timedelta(days=3),
|
||||
"home_delivery": True, # Enable home delivery
|
||||
"delivery_product_id": self.delivery_product.id,
|
||||
"cutoff_day": "0",
|
||||
}
|
||||
)
|
||||
|
|
@ -362,7 +372,7 @@ class TestSaveOrderEndpoints(TransactionCase):
|
|||
"period": "weekly",
|
||||
"pickup_day": "5",
|
||||
"pickup_date": datetime.now().date() + timedelta(days=12),
|
||||
"home_delivery": True,
|
||||
"delivery_product_id": self.delivery_product.id,
|
||||
"cutoff_day": "0",
|
||||
}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue