Search code examples
pythonodooodoo-13

Odoo 13 how to validate a delivery order with API (python)


I am trying to make Odoo delivery orders as validated with the API.

Similar to this How to validate a Odoo delivery order with XMLRPC PHP? Note this is in PHP.

    close_order = models.execute_kw(db, uid, password,
                                'stock.move', 'search',
                                [[['origin', '=', 'S0032']]],
                                )
print(close_order)


so_id = models.execute_kw(db, uid, password, 'stock.move', 'write', [close_order, {
    'state': 'done'
}])

This searches for the stock move and marks it as done. But the products are still marked as reserved. How can I mark the delivery orders as validated?


Solution

  • I was able to figure it out. For those having similar issues. I had to create then process stock.immediate.transfer to validate the stock move.

    https://github.com/odoo/odoo/blob/13.0/addons/stock/wizard/stock_immediate_transfer.py#L14