Ir al contenido
Menú
Se marcó esta pregunta
2288 Vistas

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
jun 23
2992
1
ene 23
2769
0
sept 22
2475
1
ago 22
3425
0
ago 22
2604