Skip to Content
Menu
This question has been flagged

Hello all,

When we confirm a pos order, the generated picking and the stock moves are automatically proceeded.

What would be the best approach to make the same thing with a sale order?

I want that all picking and stock moves created by a sale order confirmation be automatically proceeded.

thanks to guide me.


UPDATE #1

In the class pos_order, there is a create_picking method.

At the end of this create_picking method, there are those lines who confirm the picking and moves :

            if picking_id:
picking_obj.action_confirm(cr, uid, [picking_id], context=context)
picking_obj.force_assign(cr, uid, [picking_id], context=context)
picking_obj.action_done(cr, uid, [picking_id], context=context)
elif move_list:
move_obj.action_confirm(cr, uid, move_list, context=context)
move_obj.force_assign(cr, uid, move_list, context=context)
move_obj.action_done(cr, uid, move_list, context=context)


I'm searching the best place to do the same with a regular sale_order.

Avatar
Discard

I'm curious about the business scenario that requires this, and why POS can't be used to handle the order.

Author Best Answer

Here is my solution :

I have put it in a custom module.

class stock_move(osv.osv):
_inherit = "stock.move"
_order = 'id desc'
def action_confirm(self, cr, uid, ids, context=None):
res = super(stock_move, self).action_confirm(cr, uid, ids, context=context)
moves = self.browse(cr, uid, ids, context=context)
picking_obj = self.pool.get("stock.picking")
picking_id = []
for move in moves:
if move.picking_id.id not in picking_id:
picking_id.append(move.picking_id.id)
for id in picking_id:
picking_obj.action_confirm(cr, uid, [id], context=context)
picking_obj.force_assign(cr, uid, [id], context=context)
picking_obj.action_done(cr, uid, [id], context=context)
return res




Avatar
Discard
Related Posts Replies Views Activity
0
Feb 16
2384
3
Mar 18
3612
1
Mar 17
4383
4
Sep 16
3026
1
Feb 16
5657