You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When closing a sales order short on an assembly product, the current close-short logic (#495) adjusts each line independently based on PO quantity_completed. But for assemblies, BOM ratios determine the actual bottleneck:
Real-world example (SO-2026-0044):
SO for 5 assemblies, each requiring 1 gearbox + 2 keycaps + 3 phone stands
Production completed: 5 gearboxes, 10 keycaps, 12 phone stands (short by 3)
Problem
When closing a sales order short on an assembly product, the current close-short logic (#495) adjusts each line independently based on PO
quantity_completed. But for assemblies, BOM ratios determine the actual bottleneck:Real-world example (SO-2026-0044):
Requirements
BOM-aware bottleneck calculation
produced / bom_ratio= max possible assembliesmin()across all componentsInventory reversal transactions
TransactionService._create_inventory_transaction()and_create_journal_entry()for atomicityPO status reconciliation
Must also handle
Depends on
Files likely touched
backend/app/services/sales_order_service.py— BOM-aware close_short logicbackend/app/services/transaction_service.py— inventory reversal + GL entriesbackend/app/services/inventory_service.py— FG receipt back to stockbackend/app/models/production_order.py— PO close-short statusfrontend/src/pages/admin/OrderDetail.jsx— enhanced close-short modal with BOM breakdown