Go to file
2025-10-04 11:33:39 +07:00
__pycache__ first commit 2025-10-04 11:33:39 +07:00
models first commit 2025-10-04 11:33:39 +07:00
views first commit 2025-10-04 11:33:39 +07:00
__init__.py first commit 2025-10-04 11:33:39 +07:00
__manifest__.py first commit 2025-10-04 11:33:39 +07:00
README.md first commit 2025-10-04 11:33:39 +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
  • 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
  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

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
  • 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
  • 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