Odoo Help

0

How to confirm a delivery order from sale order screen ?

By
Vikram
on 6/27/14, 6:38 AM 1,364 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.

 

 

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 6/27/14, 6:38 AM
Seen: 1364 times
Last updated: 3/16/15, 8:10 AM