[FIX] Correct resupply pull rules to have the correct warehouses to propagate / serve so it works with MTO rules also

This commit is contained in:
Josse Colpaert 2014-12-16 18:09:20 +01:00
parent e07309d809
commit d849c55599
1 changed files with 4 additions and 4 deletions

View File

@ -2945,7 +2945,7 @@ class stock_warehouse(osv.osv):
inter_wh_route_vals = self._get_inter_wh_route(cr, uid, warehouse, wh, context=context)
inter_wh_route_id = route_obj.create(cr, uid, vals=inter_wh_route_vals, context=context)
values = [(output_loc, transit_location, wh.out_type_id.id, wh), (transit_location, input_loc, warehouse.in_type_id.id, warehouse)]
pull_rules_list = self._get_supply_pull_rules(cr, uid, warehouse, values, inter_wh_route_id, context=context)
pull_rules_list = self._get_supply_pull_rules(cr, uid, wh.id, values, inter_wh_route_id, context=context)
for pull_rule in pull_rules_list:
pull_obj.create(cr, uid, vals=pull_rule, context=context)
#if the warehouse is also set as default resupply method, assign this route automatically to the warehouse
@ -3006,7 +3006,7 @@ class stock_warehouse(osv.osv):
'sequence': 10,
}
def _get_supply_pull_rules(self, cr, uid, supplied_warehouse, values, new_route_id, context=None):
def _get_supply_pull_rules(self, cr, uid, supply_warehouse, values, new_route_id, context=None):
pull_rules_list = []
for from_loc, dest_loc, pick_type_id, warehouse in values:
pull_rules_list.append({
@ -3017,8 +3017,8 @@ class stock_warehouse(osv.osv):
'action': 'move',
'picking_type_id': pick_type_id,
'procure_method': warehouse.lot_stock_id.id != from_loc.id and 'make_to_order' or 'make_to_stock', # first part of the resuply route is MTS
'warehouse_id': supplied_warehouse.id,
'propagate_warehouse_id': warehouse.id,
'warehouse_id': warehouse.id,
'propagate_warehouse_id': supply_warehouse,
})
return pull_rules_list