2.5 KiB
2.5 KiB
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 inpurchase_order.py - Creates
purchase.order.linerecord 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_returncomputed field tostock.movemodel - 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 wherehas_return = True - Added
has_returnfield to tree views for visibility
Modified Files
-
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
- Enhanced
-
models/stock_move.py
- Added
has_returncomputed field - Added
_compute_has_return()method to detect return movements
- Added
-
views/stock_move_link_views.xml
- Added
has_returnfield to link tree view (hidden but available for filtering)
- Added
-
views/stock_move_views.xml
- Added
has_returnfield to stock move tree view (optional/hide by default)
- Added
-
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:
- Update the module in Odoo
- The
has_returnfield will be computed for all existing stock moves - Existing linked moves are not affected
- New links will automatically create purchase order lines