'Picking in without lots and picking out with'

def test_30_check_with_no_incoming_lot(self):

    picking_in = self.env['stock.picking.type'].browse(self.picking_type_in)
    picking_in.use_create_lots = False
    self.productA.tracking = 'lot'
    picking_in = self.PickingObj.create({'partner_id': self.partner_delta_id, 'picking_type_id': self.picking_type_in, 'location_id': self.supplier_location, 'location_dest_id': self.stock_location})
    self.MoveObj.create({'name': self.productA.name, 'product_id': self.productA.id, 'product_uom_qty': 4, 'product_uom': self.productA.uom_id.id, 'picking_id': picking_in.id, 'location_id': self.supplier_location, 'location_dest_id': self.stock_location})
    for move in picking_in.move_lines:
        self.assertEqual(move.state, 'draft', 'Wrong    state    of    move    line.')
    picking_in.action_confirm()
    for move in picking_in.move_lines:
        self.assertEqual(move.state, 'assigned', 'Wrong    state    of    move    line.')
    picking_in.do_transfer()
    picking_out = self.PickingObj.create({'partner_id': self.partner_agrolite_id, 'name': 'testpicking', 'picking_type_id': self.picking_type_out, 'location_id': self.stock_location, 'location_dest_id': self.customer_location})
    self.MoveObj.create({'name': self.productA.name, 'product_id': self.productA.id, 'product_uom_qty': 3, 'product_uom': self.productA.uom_id.id, 'picking_id': picking_out.id, 'location_id': self.stock_location, 'location_dest_id': self.customer_location})
    picking_out.action_confirm()
    picking_out.action_assign()
    pack_opt = self.StockPackObj.search([('picking_id', '=', picking_out.id)], limit=1)
    lot1 = self.LotObj.create({'product_id': self.productA.id, 'name': 'LOT1'})
    lot2 = self.LotObj.create({'product_id': self.productA.id, 'name': 'LOT2'})
    lot3 = self.LotObj.create({'product_id': self.productA.id, 'name': 'LOT3'})
    self.env['stock.pack.operation.lot'].create({'operation_id': pack_opt.id, 'lot_id': lot1.id, 'qty': 1.0})
    self.env['stock.pack.operation.lot'].create({'operation_id': pack_opt.id, 'lot_id': lot2.id, 'qty': 1.0})
    self.env['stock.pack.operation.lot'].create({'operation_id': pack_opt.id, 'lot_id': lot3.id, 'qty': 2.0})
    pack_opt.qty_done = 4.0
    picking_out.do_new_transfer()
    quants = self.StockQuantObj.search([('product_id', '=', self.productA.id), ('location_id', '=', self.stock_location)])
    self.assertFalse(quants, 'Should    not    have    any    quants    in    stock    anymore')
    quants = self.StockQuantObj.search([('product_id', '=', self.productA.id), ('location_id', '=', self.customer_location)])
    self.assertEqual(sum([x.qty for x in quants]), 4, 'Wrong    total    sum    of    quants')
    self.assertEqual(sum([x.qty for x in quants if (not x.lot_id)]), 0.0, 'Wrong    sum    of    quants    with    no    lot')
    self.assertEqual(sum([x.qty for x in quants if (x.lot_id.id == lot1.id)]), 1.0, 'Wrong    sum    of    quants    with    lot    1')
    self.assertEqual(sum([x.qty for x in quants if (x.lot_id.id == lot2.id)]), 1.0, 'Wrong    sum    of    quants    with    lot    2')
    self.assertEqual(sum([x.qty for x in quants if (x.lot_id.id == lot3.id)]), 2.0, 'Wrong    sum    of    quants    with    lot    3')
