Search code examples
pythonpostgresqlodoorecord

Create a new record with one2many


I want to create a new line in stock.picking, which will contain the date and the quantity:

 myRec.pack_lot_ids.create({'id': my_id,'qty': myQty})

There's no error,but the line is not created,SO I tried with

 myRec.pack_lot_ids.create(0,0,{'id': my_id,'qty': myQty})

There I have an error : only 2 args, 4 given.

Is there another way to create a line of one2many


Solution

  • myRec.pack_lot_ids.create({'id': my_id,'qty': myQty}) : this is correct you need to pass the parent ID to establish a link.