Pick Management Line Documentation¶
Overview¶
The Pick Management Line module (pick.management.line) represents individual items to be picked within a picking list. Each line contains details about a specific product, quantity, location, and tracking information for warehouse picking operations.
Model Information¶
Model Name: pick.management.line
Display Name: Pick Management Line
Key Fields: N/A
Features¶
- ❌ Audit logging enabled
- ❌ Multi-company support
- ❌ Cascade deletion with parent pick management
Key Fields Reference¶
Line Fields¶
| Field | Type | Required | Description |
|---|---|---|---|
product_code |
Many2One | ❌ | Product to be picked (product) |
barcode |
Many2One | ❌ | Alternative product reference by barcode (product) |
qty |
Decimal | ❌ | Quantity to pick |
central_ord_no |
Many2One | ❌ | Associated central order number (central.order) |
tracking_no |
Char | ❌ | Shipment tracking number |
location |
Many2One | ❌ | Stock location where product is stored (stock.location) |
Relationship Fields¶
| Field | Type | Description |
|---|---|---|
pick_management_id |
Many2One | Parent pick management record (implicit) |
API Methods¶
1. Create Pick Management Line¶
Method: create(vals, context)
Creates a new picking line item.
Parameters:
vals = {
"pick_management_id": 1, # Required if not from parent
"product_code": 456, # Optional: Product reference
"barcode": 789, # Optional: Barcode reference
"qty": 10, # Optional: Quantity to pick
"central_ord_no": 123, # Optional: Central order
"tracking_no": "TRK12345", # Optional: Tracking number
"location": 789 # Optional: Pick location
}
Returns: int - New line ID
Example:
# Add a line to an existing pick management
line_id = get_model("pick.management.line").create({
"pick_management_id": pick_id,
"product_code": 505,
"qty": 15,
"location": 301,
"tracking_no": "TRK-2025-001"
})
2. Bulk Create Lines¶
Method: Multiple create() calls or nested creation
Creates multiple lines at once.
Example:
# Method 1: Create with parent
pick_id = get_model("pick.management").create({
"picking_list_number": "PKL-001",
"lines": [
("create", {
"product_code": prod1_id,
"qty": 10,
"location": loc1_id
}),
("create", {
"product_code": prod2_id,
"qty": 5,
"location": loc1_id
})
]
})
# Method 2: Add to existing pick management
for product_data in products_to_pick:
get_model("pick.management.line").create({
"pick_management_id": pick_id,
"product_code": product_data["id"],
"qty": product_data["qty"],
"location": product_data["location"]
})
3. Update Line¶
Method: write(ids, vals, context)
Updates existing line data.
Example:
# Update quantity for a line
line = get_model("pick.management.line").browse(line_id)
line.write({"qty": 20})
# Update location
line.write({"location": new_location_id})
4. Delete Line¶
Method: delete(ids, context)
Deletes a picking line.
Example:
Search Functions¶
Search by Location¶
# Find all pick lines for a specific warehouse location
condition = [["location", "=", location_id]]
lines = get_model("pick.management.line").search(condition)
Search by Product¶
# Find lines for a specific product
condition = [["product_code", "=", product_id]]
lines = get_model("pick.management.line").search(condition)
Search by Central Order¶
# Find pick lines associated with a central order
condition = [["central_ord_no", "=", order_id]]
lines = get_model("pick.management.line").search(condition)
Search by Tracking Number¶
# Find line by tracking number
condition = [["tracking_no", "=", "TRK12345"]]
lines = get_model("pick.management.line").search(condition)
Related Models¶
| Model | Relationship | Description |
|---|---|---|
pick.management |
Many2One | Parent picking list |
product |
Many2One | Product to be picked |
stock.location |
Many2One | Warehouse location |
central.order |
Many2One | Central order reference |
Common Use Cases¶
Use Case 1: Add Item to Existing Picking List¶
# Add more items to an existing picking list
line_id = get_model("pick.management.line").create({
"pick_management_id": pick_id,
"product_code": new_product_id,
"qty": 8,
"location": location_id,
"tracking_no": "TRK-NEW-001"
})
Use Case 2: Update Pick Quantity¶
# Adjust quantity after stock check
line = get_model("pick.management.line").browse(line_id)
# Check available stock
available_qty = get_available_stock(line.product_code.id, line.location.id)
if available_qty < line.qty:
# Adjust to available quantity
line.write({"qty": available_qty})
Use Case 3: Split Pick Line by Location¶
# Split a line across multiple locations
original_line = get_model("pick.management.line").browse(line_id)
total_qty = original_line.qty
# Location 1: 60% of quantity
get_model("pick.management.line").create({
"pick_management_id": original_line.pick_management_id.id,
"product_code": original_line.product_code.id,
"qty": total_qty * 0.6,
"location": location1_id
})
# Location 2: 40% of quantity
get_model("pick.management.line").create({
"pick_management_id": original_line.pick_management_id.id,
"product_code": original_line.product_code.id,
"qty": total_qty * 0.4,
"location": location2_id
})
# Delete original line
original_line.delete()
Use Case 4: Find Lines by Barcode¶
# Use barcode for quick product lookup
barcode_value = "123456789"
# Find product by barcode
product = get_model("product").search_browse([
["barcode", "=", barcode_value]
])
if product:
# Find all pick lines for this product
lines = get_model("pick.management.line").search_browse([
["product_code", "=", product[0].id]
])
for line in lines:
print(f"Pick: {line.pick_management_id.picking_list_number}")
print(f"Qty: {line.qty}, Location: {line.location.name}")
Best Practices¶
1. Always Specify Location¶
# Good: Include location information for efficient picking
line_vals = {
"product_code": product_id,
"qty": 10,
"location": specific_location_id # ✅ Helps picker find items quickly
}
# Bad: No location specified
line_vals = {
"product_code": product_id,
"qty": 10
# ❌ No location - picker must search
}
2. Use Barcode Field for Scanning¶
# Good: Use barcode field when available
line_vals = {
"barcode": barcode_product_id, # ✅ Faster for scanning systems
"qty": 5,
"location": location_id
}
# Also good: Use product_code if no barcode
line_vals = {
"product_code": product_id, # ✅ Standard reference
"qty": 5,
"location": location_id
}
3. Include Tracking Information¶
# Good: Add tracking for shipment visibility
line_vals = {
"product_code": product_id,
"qty": 10,
"location": location_id,
"tracking_no": tracking_number, # ✅ Enables tracking
"central_ord_no": order_id # ✅ Links to order
}
Performance Tips¶
1. Batch Retrieve Lines¶
# Efficient: Get all lines for a pick at once
pick = get_model("pick.management").browse(pick_id)
lines = pick.lines # ✅ Single query for all lines
# Less efficient: Query lines individually
for line_id in line_ids:
line = get_model("pick.management.line").browse(line_id) # ❌ Multiple queries
2. Use Search Conditions Effectively¶
# Efficient: Filter at database level
lines = get_model("pick.management.line").search_browse([
["location", "=", location_id],
["qty", ">", 0]
]) # ✅ Database filtering
# Less efficient: Filter in Python
all_lines = get_model("pick.management.line").search_browse([])
filtered = [l for l in all_lines if l.location.id == location_id and l.qty > 0] # ❌ Load all, then filter
3. Index on Search Fields¶
- The
locationandcentral_ord_nofields are indexed withsearch=True - Use these fields in search conditions for optimal performance
Troubleshooting¶
"Cannot find product"¶
Cause: Invalid product_code or barcode reference
Solution: Verify product exists before creating line
"Location not found"¶
Cause: Invalid location reference
Solution: Ensure location exists and is of type "internal"
"Line not showing in picking list"¶
Cause: Missing pick_management_id reference
Solution: Always specify parent pick_management_id when creating lines independently
Testing Examples¶
Unit Test: Create Line¶
def test_create_pick_line():
# Create parent pick management
pick_id = get_model("pick.management").create({
"picking_list_number": "TEST-001"
})
# Create line
line_id = get_model("pick.management.line").create({
"pick_management_id": pick_id,
"product_code": product_id,
"qty": 10,
"location": location_id
})
# Verify
line = get_model("pick.management.line").browse(line_id)
assert line.pick_management_id.id == pick_id
assert line.qty == 10
Unit Test: Update Quantity¶
def test_update_quantity():
# Create line with initial quantity
line_id = get_model("pick.management.line").create({
"pick_management_id": pick_id,
"product_code": product_id,
"qty": 10,
"location": location_id
})
# Update quantity
line = get_model("pick.management.line").browse(line_id)
line.write({"qty": 15})
# Verify
line = get_model("pick.management.line").browse(line_id)
assert line.qty == 15
Version History¶
Last Updated: 2025-10-27
Model Version: pick_management_line.py
Framework: Netforce
Additional Resources¶
- Pick Management Documentation:
pick.management - Product Documentation:
product - Stock Location Documentation:
stock.location
This documentation is generated for developer onboarding and reference purposes.