# Upgrade Guide - Version 18.0.1.1.0 ## Overview This upgrade adds two major enhancements to the Subcontracting Inventory Move First module: 1. Automatic creation of purchase order lines when linking subcontracting moves 2. Filtering out subcontracting moves that have returns ## Installation Steps ### 1. Update Module Files Ensure all module files are updated to version 18.0.1.1.0 ### 2. Upgrade Module in Odoo ```bash # Option 1: Via Odoo UI 1. Go to Apps menu 2. Remove "Apps" filter 3. Search for "Subcontracting Inventory Move First" 4. Click "Upgrade" button # Option 2: Via Command Line ./odoo-bin -u subcontracting_inventory_move_first -d your_database_name ``` ### 3. Verify Installation After upgrade, verify: - The `has_return` field is computed for all stock moves - The link dialog only shows moves without returns - Linking a move creates a purchase order line automatically ## What's New ### Feature 1: Auto-Create Purchase Order Lines **Before:** When linking a subcontracting move to a purchase order, you had to manually create the purchase order line. **After:** The system automatically creates a purchase order line with: - Product from the move - Quantity from the move's demand quantity - Unit of measure from the move - Price from product's standard price **Example:** ``` Subcontracting Move: - Product: Component A - Quantity: 100 Units After Linking → Purchase Order Line Created: - Product: Component A - Quantity: 100 - UoM: Units - Price: $10.00 (from product standard price) ``` ### Feature 2: Filter Moves with Returns **Before:** All subcontracting moves were shown in the link dialog, including those with returns. **After:** Only valid moves (without returns) are shown in the link dialog. **How it works:** - The system checks if any return move references the original move - Moves with returns are automatically filtered out - The `has_return` field is available in tree views for manual filtering ## Testing the Upgrade ### Test Case 1: Auto-Create Purchase Order Line 1. Create a subcontracting move with: - Product: Test Product - Quantity: 50 2. Create a purchase order 3. Click "Link Subcontracting Moves" 4. Select the move and click "Link to Purchase Order" 5. **Expected Result:** A purchase order line is automatically created with the product and quantity ### Test Case 2: Filter Moves with Returns 1. Create a subcontracting move and mark it as done 2. Create a return for this move 3. Create a new purchase order 4. Click "Link Subcontracting Moves" 5. **Expected Result:** The move with return should NOT appear in the list ## Rollback Instructions If you need to rollback: 1. Restore the previous version files 2. Downgrade the module: ```bash ./odoo-bin -u subcontracting_inventory_move_first -d your_database_name ``` ## Support For issues or questions: - Check the CHANGELOG.md for detailed changes - Review the README.md for usage instructions - Contact: Suherdy Yacob ## Database Changes ### New Fields Added: - `stock.move.has_return` (Boolean, Computed, Stored) ### Modified Methods: - `purchase.order.link_selected_subcontracting_move()` - Now creates PO lines - `purchase.order.action_link_subcontracting_moves()` - Updated domain filter - `stock.move._compute_has_return()` - New compute method ### No Data Migration Required This upgrade does not require data migration. All changes are backward compatible.