subcontracting_inventory_mo.../CHANGELOG.md

64 lines
2.5 KiB
Markdown

# Changelog - Subcontracting Inventory Move First Module
## Version 18.0.1.1.0 - Enhancement
### New Features
#### 1. Automatic Purchase Order Line Creation
When a user selects a subcontracting move to link to a purchase order, the system now automatically creates a purchase order line with:
- Product from the subcontracting move
- Quantity from the move's demand quantity (product_uom_qty)
- Unit of measure from the move
- Price unit from the product's standard price
- Planned date from the move date
- Product description as the line name
**Implementation:**
- Modified `link_selected_subcontracting_move()` method in `purchase_order.py`
- Creates `purchase.order.line` record automatically when linking moves
#### 2. Filter Out Moves with Returns
The module now filters out subcontracting moves that have return movements, ensuring only valid subcontracting moves (without returns) can be linked to purchase orders.
**Implementation:**
- Added `has_return` computed field to `stock.move` model
- Field checks if any return moves reference the current move via `origin_returned_move_id`
- Updated domain in `action_link_subcontracting_moves()` to exclude moves where `has_return = True`
- Added `has_return` field to tree views for visibility
### Modified Files
1. **models/purchase_order.py**
- Enhanced `link_selected_subcontracting_move()` to create purchase order lines
- Updated `action_link_subcontracting_moves()` domain to filter out moves with returns
2. **models/stock_move.py**
- Added `has_return` computed field
- Added `_compute_has_return()` method to detect return movements
3. **views/stock_move_link_views.xml**
- Added `has_return` field to link tree view (hidden but available for filtering)
4. **views/stock_move_views.xml**
- Added `has_return` field to stock move tree view (optional/hide by default)
5. **README.md**
- Updated features list
- Updated usage instructions
- Updated technical details
### Benefits
- **Improved Efficiency**: No need to manually create purchase order lines after linking moves
- **Data Accuracy**: Product and quantity are automatically copied from the subcontracting move
- **Better Data Integrity**: Prevents linking of invalid moves (those with returns)
- **Cleaner Workflow**: Only valid subcontracting moves are shown in the selection list
### Upgrade Notes
After upgrading to this version:
1. Update the module in Odoo
2. The `has_return` field will be computed for all existing stock moves
3. Existing linked moves are not affected
4. New links will automatically create purchase order lines