Go to file
2025-11-27 10:10:08 +07:00
__pycache__ fix some bug regarding the groups in xml view 2025-11-20 08:49:19 +07:00
models add new feature to automate filling purchase order line and filtering out subcontract move that have return movement 2025-11-24 13:27:57 +07:00
views add new feature to automate filling purchase order line and filtering out subcontract move that have return movement 2025-11-24 13:27:57 +07:00
__init__.py first commit 2025-10-04 11:33:39 +07:00
__manifest__.py add new feature to automate filling purchase order line and filtering out subcontract move that have return movement 2025-11-24 13:27:57 +07:00
CHANGELOG.md add new feature to automate filling purchase order line and filtering out subcontract move that have return movement 2025-11-24 13:27:57 +07:00
README.md add new feature to automate filling purchase order line and filtering out subcontract move that have return movement 2025-11-24 13:27:57 +07:00

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

  1. Navigate to Inventory > Operations > Transfers
  2. Create a new transfer with operation type "Resupply Subcontractor"
  3. The inventory move will be created without being linked to a purchase order initially

Linking to Purchase Orders

  1. Go to the purchase order you want to link
  2. Click the "Link Subcontracting Moves" button
  3. Select the appropriate inventory moves from the list (only moves without returns will be shown)
  4. Click the "Link to Purchase Order" button at the top of the list view to confirm linking
  5. The moves will be linked to the purchase order and source document fields updated
  6. Purchase order lines will be automatically created with the product and demand quantity from the selected moves

Viewing Linked Moves

  1. On any purchase order form, the smart button "Subcontracting Moves" will show the count of linked moves
  2. Click the button to view and manage all linked inventory moves

Technical Details

  • The module adds a purchase_order_id field to stock.move to track links to purchase orders
  • The module adds a subcontracting_move_ids field to purchase.order to track linked moves
  • The module adds a has_return computed field to stock.move to 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