Ir al contenido
Menú
Se marcó esta pregunta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
may 24
980
5
may 20
18448
1
feb 24
3586
1
may 20
7040
3
sept 23
7323