Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2395 Visualizzazioni

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
giu 23
3257
1
gen 23
3043
0
set 22
2751
1
ago 22
3730
0
ago 22
2870