Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

What would be the best approach to automatically proceed all stock moves ans pickings generated by a sale order confirmation?

By
Pascal Tremblay
on 2/26/16, 9:15 AM 463 views

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.

Bista Solutions US, Ray Carnes
on 2/26/16, 10:21 AM
0

Pascal Tremblay

--Pascal Tremblay--
1312
| 5 2 7
Alma, Canada
--Pascal Tremblay--


Pascal Tremblay
On 2/28/16, 11:27 AM

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




Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/26/16, 9:15 AM
Seen: 463 times
Last updated: 2/28/16, 11:27 AM