Skip to Content
Menu
This question has been flagged
1894 Views

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 


Avatar
Discard
Related Posts Replies Views Activity
1
Jun 23
1923
1
Jan 23
1741
0
Sep 22
1619
1
Aug 22
2525
0
Aug 22
1847