Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

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()
Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
maj 24
992
5
maj 20
18461
1
lut 24
3611
1
maj 20
7060
3
wrz 23
7348