apexprogramming
apexprogramming

Reputation: 433

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?

Upvotes: 0

Views: 1054

Answers (2)

apexprogramming
apexprogramming

Reputation: 433

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

Upvotes: 1

Dipen Shah
Dipen Shah

Reputation: 2454

hedgethenight

With change, the state will not do the background process to validate the stock.move. You have to execute the method which can be processed to done the stock.move.

How to Execute the method from XML-RPC

models.execute_kw(db, uid, password, 'object', 'method', [[id]])

Upvotes: 0

Related Questions