| __pycache__ | ||
| models | ||
| views | ||
| __init__.py | ||
| __manifest__.py | ||
| CHANGELOG.md | ||
| README.md | ||
Subcontracting Inventory Move First
Overview
This module extends the standard Odoo subcontracting workflow to allow creating inventory moves first and then linking them to purchase orders, rather than the standard flow where purchase orders create inventory moves.
Features
- Create "Resupply Subcontract" inventory moves directly in the inventory module
- Link these moves to purchase orders after creation
- Automatically create purchase order lines with product and demand quantity when linking moves
- Filter out subcontracting moves with returns - only valid moves (without returns) can be linked
- Smart button on purchase orders to view linked inventory moves
- Maintain data consistency between moves and purchase orders
- Update source document field in inventory moves and related stock pickings to show purchase order number
- Proper handling of purchase order cancellation to unlink moves
Usage
Creating Subcontracting Inventory Moves First
- Navigate to Inventory > Operations > Transfers
- Create a new transfer with operation type "Resupply Subcontractor"
- The inventory move will be created without being linked to a purchase order initially
Linking to Purchase Orders
- Go to the purchase order you want to link
- Click the "Link Subcontracting Moves" button
- Select the appropriate inventory moves from the list (only moves without returns will be shown)
- Click the "Link to Purchase Order" button at the top of the list view to confirm linking
- The moves will be linked to the purchase order and source document fields updated
- Purchase order lines will be automatically created with the product and demand quantity from the selected moves
Viewing Linked Moves
- On any purchase order form, the smart button "Subcontracting Moves" will show the count of linked moves
- Click the button to view and manage all linked inventory moves
Technical Details
- The module adds a
purchase_order_idfield tostock.moveto track links to purchase orders - The module adds a
subcontracting_move_idsfield topurchase.orderto track linked moves - The module adds a
has_returncomputed field tostock.moveto identify moves with return movements - Business logic ensures data consistency when linking/unlinking moves and orders
- When linking moves to purchase orders, the source document field is updated to show the purchase order number
- When linking moves to purchase orders, the source document field in related stock pickings is also updated
- When linking moves to purchase orders, purchase order lines are automatically created with product and quantity from the move
- Only subcontracting moves without returns can be linked to purchase orders (moves with returns are filtered out)
- Proper handling of purchase order cancellation to unlink moves without errors
Compatibility
- Compatible with Odoo 18.0
- Works alongside standard subcontracting workflow
- Depends on: mrp_subcontracting, purchase, stock, mrp_subcontracting_purchase