0

I recently switched from Odoo 13 to Odoo 15. With Odoo 13, I could process 'stock.picking' with

models.execute_kw(db, uid, password, 'stock.immediate.transfer',
                                            'create',
                                            ({'pick_ids': [pickid]})
    )
   
   models.execute_kw(db, uid, password, 'stock.immediate.transfer', 'process',
                                [createdid], {})

However now with Odoo 15, running the same process processes and returns True but the stock picking record does not close. I looked at the documentation but did not see anything regarding how to process immediate transfers.

apexprogramming
  • 403
  • 2
  • 14

1 Answers1

0

The process function has changed, now it prepares the stock pickings then call again the button_validate function to process transfers, and to do so, it will first check if button_validate_picking_ids are passed through the context.

Note that even if the function did call the button_validate function again it will return True and if you call button_validate manually after you call the process function, the transfer will be processed and passed to the done state.

models.execute_kw(db, uid, password, 'stock.picking', 'button_validate', [picking_ids])

You can reproduce the same logic to process a transfer (pass the context to the wizard process function):

action = models.execute_kw(db, uid, password, 'stock.picking', 'button_validate', [picking_ids])

values = {'pick_ids': [(6, 0, picking_ids)], 
          'immediate_transfer_line_ids': [(0, 0, {'to_immediate': True, 'picking_id': pick_id}) for pick_id in picking_ids]}

transfer_id = models.execute_kw(db, uid, password, 'stock.immediate.transfer', 'create', [values])
models.execute_kw(db, uid, password, 'stock.immediate.transfer', 'process', [transfer_id], {'context': action['context']})
Kenly
  • 24,317
  • 7
  • 44
  • 60