Delivery Slot Capacity Documentation¶
Overview¶
The Delivery Slot Capacity module (delivery.slot.capacity) defines day-specific delivery limits for time slots. Supports capacity management per weekday and postal code exclusions for flexible delivery scheduling.
Model Information¶
Model Name: delivery.slot.capacity
Display Name: Delivery Slot Capacity
Key Fields: None
Features¶
- ❌ No audit logging
- ❌ No multi-company support
- ❌ No full-text search
- ✅ Cascade delete with parent slot
Key Fields Reference¶
| Field | Type | Required | Description |
|---|---|---|---|
slot_id |
Many2One | ✅ | Parent delivery slot (cascade delete) |
weekday |
Selection | ❌ | Day of week (0=Mon, 6=Sun) |
capacity |
Integer | ✅ | Maximum deliveries |
exclude_postal_codes |
Text | ❌ | Comma-separated postal codes to exclude |
Weekday Values¶
| Value | Day |
|---|---|
"0" |
Monday |
"1" |
Tuesday |
"2" |
Wednesday |
"3" |
Thursday |
"4" |
Friday |
"5" |
Saturday |
"6" |
Sunday |
Common Use Cases¶
Use Case 1: Variable Capacity by Day¶
slot_id = 1 # Morning slot
# Weekday capacities
capacities = {
"0": 50, # Monday - high
"1": 50, # Tuesday - high
"2": 45, # Wednesday
"3": 45, # Thursday
"4": 40, # Friday
"5": 20, # Saturday - low
"6": 0 # Sunday - closed
}
for weekday, cap in capacities.items():
if cap > 0:
get_model("delivery.slot.capacity").create({
"slot_id": slot_id,
"weekday": weekday,
"capacity": cap
})
Use Case 2: Exclude Postal Codes¶
# Exclude remote areas from evening delivery
get_model("delivery.slot.capacity").create({
"slot_id": evening_slot_id,
"weekday": "0", # Monday
"capacity": 30,
"exclude_postal_codes": "99000, 99001, 99002" # Remote postcodes
})
Use Case 3: Check Postal Code Exclusion¶
def is_postal_code_excluded(capacity_id, postal_code):
"""Check if postal code is excluded from slot capacity"""
capacity = get_model("delivery.slot.capacity").browse(capacity_id)
if not capacity.exclude_postal_codes:
return False
excluded = [pc.strip() for pc in capacity.exclude_postal_codes.split(',')]
return postal_code in excluded
# Usage
is_excluded = is_postal_code_excluded(1, "99000")
Related Models¶
| Model | Relationship | Description |
|---|---|---|
delivery.slot |
Many2One | Parent time slot (cascade) |
Best Practices¶
1. Configure All Weekdays¶
# Good: Define capacity for all 7 days
for weekday in ["0", "1", "2", "3", "4", "5", "6"]:
capacity = 40 if weekday in ["0", "1", "2", "3", "4"] else 20
get_model("delivery.slot.capacity").create({
"slot_id": slot_id,
"weekday": weekday,
"capacity": capacity
})
2. Format Postal Code Exclusions¶
# Good: Clean, comma-separated list
get_model("delivery.slot.capacity").create({
"slot_id": slot_id,
"weekday": "0",
"capacity": 30,
"exclude_postal_codes": "99000, 99001, 99002"
})
# Avoid: Inconsistent formatting
exclude_postal_codes = "99000,99001 , 99002" # Spaces inconsistent
Version History¶
Last Updated: October 2025
Model File: delivery_slot_capacity.py
Framework: Netforce
This documentation is generated for developer onboarding and reference purposes.