跳至内容
菜单
此问题已终结
2286 查看

I have a custom module. I have a button when I click that button I want to create several lines based on the quantity of each line. for instance I have this record that contains two lines (Box = 9 && pack = 4). 9 & 4 are representing the quantity. When I click that button I want to create 9 records for the box line and 4 records for the pack line in another model. here is my code that gives me this error " can't adapt type 'generator' odoo " 


  def delivery_order(self):
    org = self.name
    
    delivery = self.env['logistic.warehouse'].create({
        'name': self.name,
        'state': 'draft',
        # 'picking_type_id': 1,
        # 'partner_id': self.partner_id.id,
        'consignee_id': self.consignee_id.id,
        'date_of_receive': self.date_of_receive,
        'origin': self.name,
        'warehouse_line_ids': [((0, 0, {
            'origin': org,
            'description': qyt.description,
            'weight': qyt.weight

        })for qyt in range(line.quantity)) for line in self.product_line_ids]

    })
    return delivery 


形象
丢弃
相关帖文 回复 查看 活动
1
6月 23
2975
1
1月 23
2762
0
9月 22
2469
1
8月 22
3424
0
8月 22
2599