[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
This commit is contained in:
Quentin (OpenERP) 2013-10-24 10:03:25 +02:00
parent 52c30fdd38
commit 86d58ed2dd
1 changed files with 3 additions and 4 deletions

View File

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