Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
5447 Vizualizări

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.

Imagine profil
Abandonează

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

Autor Cel mai bun răspuns

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




Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
feb. 16
3437
3
mar. 18
4813
1
mar. 17
6243
4
sept. 16
4179
1
feb. 16
6819