From 92ec666f8d70134b87ab4b28494bb9771202b451 Mon Sep 17 00:00:00 2001 From: amoyaux Date: Mon, 21 Aug 2017 15:55:28 +0200 Subject: [PATCH] [FIX] stock: change delivery method on a supplied warehouse Use case to reproduce: - Create multiple warehouse - Select a warehouse to ressuply on a warehouse form view - Go to the supplied warehouse form view - Change the delivery method -> Traceback can't adapt stock.location type This happens because there is a write method using a stock location instead of its id. This commit use the location id instead of location --- addons/stock/models/stock_warehouse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_warehouse.py b/addons/stock/models/stock_warehouse.py index 40dfa3ace5c..b8bac68fe9c 100644 --- a/addons/stock/models/stock_warehouse.py +++ b/addons/stock/models/stock_warehouse.py @@ -552,7 +552,7 @@ class Warehouse(models.Model): routes = self.env['stock.location.route'].search([('supplier_wh_id', '=', self.id)]) pulls = Pull.search(['&', ('route_id', 'in', routes.ids), ('location_id.usage', '=', 'transit')]) pulls.write({ - 'location_src_id': new_location, + 'location_src_id': new_location.id, 'procure_method': change_to_multiple and "make_to_order" or "make_to_stock"}) if not change_to_multiple: # If single delivery we should create the necessary MTO rules for the resupply