Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
5463 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ

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

Tác giả Câu trả lời hay nhất

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




Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 2 16
3453
3
thg 3 18
4827
1
thg 8 25
139
1
thg 3 17
6277
4
thg 9 16
4196