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

How to confirm a delivery order from sale order screen ?

By
Vikram
on 6/27/14, 6:38 AM 1,062 views

How to confirm a devilery order (reduce stocks in location) from confirm sale button in sale order screen. I tried from sale order inherits and call a stock function from sale order. but i couldnt do it. give me solution.

I want to reduce a stock once i press confirm sale button. How to by-pass delivery workflow ?

I tried with following code,

stock_pick_obj = self.pool.get('stock.picking.out')
stock_move_obj = self.pool.get('stock.move')

 

wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'stock.picking', picking.id, 'button_confirm', cr)

 stock_move_obj.action_confirm(cr, uid, move_idds, context=context)
 wf_service.trg_validate(uid, 'stock.picking', picking.id, 'button_done', cr)

 

 

0
Vikram
On 6/27/14, 9:36 AM

i found a solution for confirming a delivery order from sale order confirm button.Here i shared the code for achieving this,

Inherit a existing workflow and add a follwong lines,

                picking = stock_pick_obj.browse(cr, uid, pick_id)
                wf_service = netsvc.LocalService("workflow")
                wf_service.trg_validate(uid, 'stock.picking', picking.id, 'button_confirm', cr)
                self.pool.get('stock.move').force_assign(cr, uid, move_idds)
                wf_service.trg_write(uid, 'stock.picking',picking.id, cr)
                self.pool.get('stock.picking').action_move(cr, uid, [picking.id], context=context)
                wf_service.trg_validate(uid, 'stock.picking', picking.id, 'button_done', cr)

Give any other solutions if you have to achieve better than this.

Thanks.

 

 

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: 6/27/14, 6:38 AM
Seen: 1062 times
Last updated: 3/16/15, 8:10 AM