This question has been flagged
2 Replies
3681 Views

Hello,

i am working on a module to set the status of a delivery order based on a csv input. 

I am using this code where delivery ID is the id of a specific delivery order:

 picking_pool = self.pool.get('stock.picking.out')

 

for delivery_order in picking_pool.browse(cr, uid, delivery_id):
                   delivery_order.action_process()
                   self.pool.get('activity.log').create_log(cr, uid, "delivery order: %s" % (delivery_order.name))

 

the script, if triggered, runs without any error, but the delivery order is not changed to delivered. Any ideas what's wrong?

Thanks  

Peter

Avatar
Discard
Best Answer

Method action_process() is used only to open the partial picking wizard.

Avatar
Discard
Author Best Answer

thanks for the reply. I understand, but which method do I have to use to change the state of the delivery order? Or do i have to update the field state explicetly? 

Avatar
Discard

You analyse method do_partial(). Change state of delivery order is associated with multiple operations. Usually one stock.picking is related to many stock.move. Additionaly change to this state generatses stock valutaions and accounts post. You need to perform several operations as easily as you want rather not be.

Author

I got that. I have been trying around and obviously changing the states of delivery orders and subsequently of the move_line within the delivery order results in a state where delivery order and stock moves are shown correctly and the stock is updated correctly as well. However, I seem to be missing something, since the the respective deliveries in magento are not updated correclty via the connector. Checking do_partial() in stock_invoice_directly/stock_invoice.py does not really help since it seems to be more related to invoicing. Just copying these calls won't fix it i suppose... Can anyone help? Hoe can I actually get the information which function is actually called if i manually flag a delivery as shipped? I did not find any documentation on this topic... Thanks Peter