Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
0
mei 24
965
5
mei 20
18432
1
feb. 24
3544
1
mei 20
7016
3
sep. 23
7290