multi-company icon indicating copy to clipboard operation
multi-company copied to clipboard

[16.0][FIX] purchase_sale_stock_inter_company

Open AdrianaSaiz opened this issue 6 months ago • 1 comments

Problem: In intercompany scenarios with partial deliveries from different warehouses, automatic validation fails. For instance when Company A purchases 2 units from Company B, and Company B delivers via two separate 1-unit pickings:

First delivery validates correctly but remaining quantity gets cancelled instead of creating a backorder Second delivery fails with "No corresponding line in PO" because the purchase order line was cancelled Manual validation works correctly, but automatic validation doesn't respect backorder configuration

Root Cause: The _set_intercompany_picking_qty() method returns all pickings related to the purchase order, including already completed pickings from previous partial deliveries. When processing backorders, the system attempts to validate these completed pickings, causing validation failures.

Changes Made: Changed from _action_done() to button_validate() to respect user backorder configuration instead of always canceling remaining quantities Added picking state filtering: Filter out completed/cancelled pickings before validation to prevent attempts to validate already processed transfers

Impact: Fixes intercompany partial deliveries with backorders Respects user backorder settings (Create/Ask/Never) Maintains backward compatibility for single deliveries

AdrianaSaiz avatar Oct 09 '25 16:10 AdrianaSaiz

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

OCA-git-bot avatar Oct 14 '25 17:10 OCA-git-bot