diff --git a/addons/sale_stock_location/sale_stock_location.py b/addons/sale_stock_location/sale_stock_location.py index 343de1c3d63..6afa8020913 100644 --- a/addons/sale_stock_location/sale_stock_location.py +++ b/addons/sale_stock_location/sale_stock_location.py @@ -43,6 +43,7 @@ class sale_order(osv.osv): res.update({ 'route_ids': routes }) + return res class sale_order_line(osv.osv): _inherit = 'sale.order.line' diff --git a/addons/sale_stock_location/sale_stock_location_view.xml b/addons/sale_stock_location/sale_stock_location_view.xml index 48706570123..35bfde30dda 100644 --- a/addons/sale_stock_location/sale_stock_location_view.xml +++ b/addons/sale_stock_location/sale_stock_location_view.xml @@ -29,7 +29,7 @@ sale.order - + diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 22a6ee18b07..00717b27179 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -1556,6 +1556,32 @@ + + stock.procurement.tree + procurement.rule + + + + + + + + + + + + + + + {} + Global procurement rules + procurement.rule + + + + + + {} Quants @@ -1587,8 +1613,8 @@ - - + + @@ -1706,7 +1732,5 @@ - - diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py index 60f838f434e..df33a55bb2b 100644 --- a/addons/stock_location/stock_location.py +++ b/addons/stock_location/stock_location.py @@ -105,7 +105,7 @@ class stock_location_path(osv.osv): 'company_id': rule.company_id and rule.company_id.id or False, 'date_expected': newdate, 'picking_id': False, - 'picking_type': move_obj.get_type_from_usage(cr, uid, move.location_id, move.location_dest_id, context=context) + 'type': move_obj.get_type_from_usage(cr, uid, move.location_id, move.location_dest_id, context=context) }) move_obj.write(cr, uid, [move.id], { 'move_dest_id': move_id, @@ -254,6 +254,21 @@ class stock_move(osv.osv): self._push_apply(cr, uid, moves, context=context) return result + def _create_procurement(self, cr, uid, move, context=None): + """ + Next to creating the procurement order, it will propagate the routes + """ + proc_id = super(stock_move, self)._create_procurement(cr, uid, move, context=context) + proc_obj = self.pool.get("procurement.order") + procs = proc_obj.search(cr, uid, [("move_id", "=", move.id)], context=context) + routes = [] + for proc in proc_obj.browse(cr, uid, procs, context=context): + routes += [x.id for x in proc.route_ids] + if routes: + proc_obj.write(cr, uid, [proc_id], {'route_ids': [(4,x) for x in routes]}, context=context) + return proc_id + + class stock_location(osv.osv): _inherit = 'stock.location' _columns = { diff --git a/addons/stock_location/stock_location_data.xml b/addons/stock_location/stock_location_data.xml index 8a47614b716..a1a9bf327ef 100644 --- a/addons/stock_location/stock_location_data.xml +++ b/addons/stock_location/stock_location_data.xml @@ -60,7 +60,7 @@ - Output > Customer + Output → Customer move