Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged

hello guys, i have migration on going from odoo 11 to odoo 13 and have something that i need to ask you about creating a record on transient model/wizard, 

I'm using this code on odoo 11 and works fine

Odoo 11 Code

stock_return_picking = request.env['stock.return.picking']\
                .sudo().with_context(active_ids=picking_done_id.ids, active_id=picking_done_id.ids[0]).create({})
res_stock_return_picking = stock_return_picking.create_returns()


but when in odoo 13 it didn't work so i see the test code from odoo 13 to create a return from sales and when i change my code like this it's work, is there any way to code it or it has to be like this using Form library from odoo.test? thank you

Odoo 13 Code

from odoo.tests import Form

stock_return_picking = Form(request.env['stock.return.picking']\
                .sudo().with_context(active_ids=picking_done_id.ids, active_id=picking_done_id.ids[0], active_model='stock.picking')).save()
res_stock_return_picking = stock_return_picking.create_returns()
Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
0
maj 24
999
5
maj 20
18479
1
feb. 24
3625
1
maj 20
7085
3
sep. 23
7363