From 8fdd6f095d009bb9941bfa49c4b141bf91149872 Mon Sep 17 00:00:00 2001 From: William Henrotin Date: Thu, 28 Oct 2021 09:50:45 +0000 Subject: [PATCH] [FIX] purchase_stock: relax the location constrains The constrains on orderpoint location being related to the warehouse view location was too restrictive especially in a complex subcontracting flow with dropship. This commit change the constrains to only be triggered if the two location to be compared have both a warehouse. closes odoo/odoo#79593 X-original-commit: 871cd6ad2d986ee1c28804aeeee63a001156154a Signed-off-by: Arnold Moyaux Signed-off-by: William Henrotin (whe) --- addons/purchase_stock/models/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase_stock/models/purchase.py b/addons/purchase_stock/models/purchase.py index f9c0873b29e..e0f0cfee839 100644 --- a/addons/purchase_stock/models/purchase.py +++ b/addons/purchase_stock/models/purchase.py @@ -483,7 +483,7 @@ class PurchaseOrderLine(models.Model): def _check_orderpoint_picking_type(self): warehouse_loc = self.order_id.picking_type_id.warehouse_id.view_location_id dest_loc = self.move_dest_ids.location_id or self.orderpoint_id.location_id - if warehouse_loc and dest_loc and not warehouse_loc.parent_path in dest_loc[0].parent_path: + if warehouse_loc and dest_loc and dest_loc.warehouse_id and not warehouse_loc.parent_path in dest_loc[0].parent_path: raise UserError(_('For the product %s, the warehouse of the operation type (%s) is inconsistent with the location (%s) of the reordering rule (%s). Change the operation type or cancel the request for quotation.', self.product_id.display_name, self.order_id.picking_type_id.display_name, self.orderpoint_id.location_id.display_name, self.orderpoint_id.display_name))