跳至内容
菜单
此问题已终结

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.

形象
丢弃

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

编写者 最佳答案

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




形象
丢弃
相关帖文 回复 查看 活动
0
2月 16
3434
3
3月 18
4809
1
3月 17
6237
4
9月 16
4170
1
2月 16
6818