How to create backorder in Odoo with XMLRPC in python?

Viewed 369

I am an odoo beginner and I am currently developing an inventory mobile app for accessing odoo remotely with XMLRPC.

I am able to set "qty_done" field for each stock.move.line in delivery order (stock.picking) and when order is complete I am able to call button_validate method and complete the order.

My goal is to create backorder from unfinished delivery order when calling button_validate method with XMLRPC.

My problem is that in odoo web client when validating delivery order wizard is opened but I would like to create backorder with XMLRPC.

enter image description here

Calling button_validate method from python with XMLRPC on unfinished delivery order return this view and i dont know how should i go about it.

{'name': 'Create Backorder?', 'type': 'ir.actions.act_window', 'view_mode': 'form', 'res_model': 'stock.backorder.confirmation', 'views': [[1530, 'form']], 'view_id': 1530, 'target': 'new', 'context': {'button_validate_picking_ids': [27], 'default_show_transfers': False, 'default_pick_ids': [[4, 27]]}}

Any help will be greatly appreciated

2 Answers

Thinking about it, why you don't create a method at Odoo side, and call it from xmlrpc with the minimal necesary parameters, and inside this new method write all your logicals. Give to Odoo the responsability, and keep as simple as posible your external app. If you need anything else, let me know.

You said "but adding button_validate_picking_ids as well was the key." Could you tell me how you did hat ?

I'm also facing this problem, I'm migrating from 13 to 14 and my external xml-rpc script to validate delivery orders.... crash :-) In fact the method stock_backorder.confirmation.process() is not usable anymore as the stock_picking.button_validate() don't return the ID anymore....

Thanks

Related