简体   繁体   English

使用 one2many 创建新记录

[英]Create a new record with one2many

I want to create a new line in stock.picking, which will contain the date and the quantity:我想在 stock.picking 中创建一个新行,其中包含日期和数量:

 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.我有一个错误:只有 2 个 args,4 个给定。

Is there another way to create a line of one2many有没有另一种方法来创建一行 one2many

myRec.pack_lot_ids.create({'id': my_id,'qty': myQty}): this is correct you need to pass the parent ID to establish a link. myRec.pack_lot_ids.create({'id': my_id,'qty': myQty}):这是正确的,您需要传递父 ID 来建立链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM