Přejít na obsah
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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
kvě 24
995
5
kvě 20
18477
1
úno 24
3619
1
kvě 20
7071
3
zář 23
7358