Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2368 Zobrazení

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
čvn 23
3255
1
led 23
3033
0
zář 22
2745
1
srp 22
3728
0
srp 22
2868