This question has been flagged

Hi, the module sale_stock adds warehouse_id into sale.order model,


After created stock.picking object and before delivery the load to a client (stock.picking.state = 'assigned', not 'done' yet) sometimes I need to change a warehouse.


Unfortunatelly warehouse_id in stock.picking, stock.move, stock.quant stays like at the beginning.


When I change the warehouse_id and location_id with the write method that does not affect the rest of the models:


picking_id = self.env['stock.picking'].search([('origin', '=', self.name)]).id

for stock_move in self.env['stock.move'].search([('picking_id', '=', picking_id)]):

stock_move.write({'warehouse_id': self.warehouse_id.id, 

              'location_id': self.warehouse_id.lot_stock_id.id})


Do I need to update all warehouse_id and location_id fields in all models manually?

Shouldn´t it have been all related and update automatically?

Avatar
Discard