From 86d58ed2ddb9c2b3baca75bf007031f3a26a781d Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 24 Oct 2013 10:03:25 +0200 Subject: [PATCH] [FIX] purchase: the location of the buy pull rule has to be the default_location_dest_id of the in_type_id of the warehouse, and not its input location which can be inactive (if reception is in 1 step) bzr revid: qdp-launchpad@openerp.com-20131024080325-pkphb3n426gaizmi --- addons/purchase/stock.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index 5799d7287e0..42b9969acab 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -20,7 +20,6 @@ ############################################################################## from openerp.osv import fields, osv -from openerp import netsvc from openerp.tools.translate import _ class stock_move(osv.osv): @@ -98,7 +97,7 @@ class stock_warehouse(osv.osv): return { 'name': self._format_routename(cr, uid, warehouse, _(' Buy'), context=context), - 'location_id': warehouse.wh_input_stock_loc_id.id, + 'location_id': warehouse.in_type_id.default_location_dest_id.id, 'route_id': buy_route_id, 'action': 'buy', 'picking_type_id': warehouse.in_type_id.id, @@ -151,6 +150,6 @@ class stock_warehouse(osv.osv): def change_route(self, cr, uid, ids, warehouse, new_reception_step=False, new_delivery_step=False, context=None): res = super(stock_warehouse, self).change_route(cr, uid, ids, warehouse, new_reception_step=new_reception_step, new_delivery_step=new_delivery_step, context=context) - if warehouse.wh_input_stock_loc_id != warehouse.buy_pull_id.id.location_id: - self.pool.get('procurement.rule').write(cr, uid, warehouse.buy_pull_id.id, {'location_id': warehouse.wh_input_stock_loc_id.id}, context=context) + if warehouse.in_type_id.default_location_dest_id != warehouse.buy_pull_id.location_id: + self.pool.get('procurement.rule').write(cr, uid, warehouse.buy_pull_id.id, {'location_id': warehouse.in_type_id.default_location_dest_id.id}, context=context) return res