def do_partial(self, cr, uid, ids, context=None):
        assert len(ids) == 1, 'Partial picking processing may only be done one at a time'
        stock_picking = self.pool.get('stock.picking')
        stock_move = self.pool.get('stock.move')
        uom_obj = self.pool.get('product.uom')
        partial = self.browse(cr, uid, ids[0], context=context)
        partial_data = {
            'delivery_date' : partial.date
        }
        picking_type = partial.picking_id.type
        for wizard_line in partial.move_ids:
            line_uom = wizard_line.product_uom
            move_id = wizard_line.move_id.id

            #Quantiny must be Positive
            if wizard_line.quantity < 0:
                raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))

            #Compute the quantity for respective wizard_line in the line uom (this jsut do the rounding if necessary)
            qty_in_line_uom = uom_obj._compute_qty(cr, uid, line_uom.id, wizard_line.quantity, line_uom.id)

            if line_uom.factor and line_uom.factor <> 0:
                if float_compare(qty_in_line_uom, wizard_line.quantity, precision_rounding=line_uom.rounding) != 0:
                    raise osv.except_osv(_('Warning'), _('The uom rounding does not allow you to ship "%s %s", only roundings of "%s %s" is accepted by the uom.') % (wizard_line.quantity, line_uom.name, line_uom.rounding, line_uom.name))
            if move_id:
                #Check rounding Quantity.ex.
                #picking: 1kg, uom kg rounding = 0.01 (rounding to 10g), 
                #partial delivery: 253g
                #=> result= refused, as the qty left on picking would be 0.747kg and only 0.75 is accepted by the uom.
                initial_uom = wizard_line.move_id.product_uom
                #Compute the quantity for respective wizard_line in the initial uom
                qty_in_initial_uom = uom_obj._compute_qty(cr, uid, line_uom.id, wizard_line.quantity, initial_uom.id)
                without_rounding_qty = (wizard_line.quantity / line_uom.factor) * initial_uom.factor
                if float_compare(qty_in_initial_uom, without_rounding_qty, precision_rounding=initial_uom.rounding) != 0:
                    raise osv.except_osv(_('Warning'), _('The rounding of the initial uom does not allow you to ship "%s %s", as it would let a quantity of "%s %s" to ship and only roundings of "%s %s" is accepted by the uom.') % (wizard_line.quantity, line_uom.name, wizard_line.move_id.product_qty - without_rounding_qty, initial_uom.name, initial_uom.rounding, initial_uom.name))
            else:
                seq_obj_name =  'stock.picking.' + picking_type
                move_id = stock_move.create(cr,uid,{'name' : self.pool.get('ir.sequence').get(cr, uid, seq_obj_name),
                                                    'product_id': wizard_line.product_id.id,
                                                    'product_qty': wizard_line.quantity,
                                                    'product_uom': wizard_line.product_uom.id,
                                                    'prodlot_id': wizard_line.prodlot_id.id,
                                                    'location_id' : wizard_line.location_id.id,
                                                    'location_dest_id' : wizard_line.location_dest_id.id,
                                                    'picking_id': partial.picking_id.id
                                                    },context=context)
                stock_move.action_confirm(cr, uid, [move_id], context)
            partial_data['move%s' % (move_id)] = {
                'product_id': wizard_line.product_id.id,
                'product_qty': wizard_line.quantity,
                'product_uom': wizard_line.product_uom.id,
                'prodlot_id': wizard_line.prodlot_id.id,
            }
            if (picking_type == 'in') and (wizard_line.product_id.cost_method == 'average'):
                partial_data['move%s' % (wizard_line.move_id.id)].update(product_price=wizard_line.cost,
                                                                  product_currency=wizard_line.currency.id)
        stock_picking.do_partial(cr, uid, [partial.picking_id.id], partial_data, context=context)
        return {'type': 'ir.actions.act_window_close'}
    def do_partial(self, cr, uid, ids, context=None):
        """ 
        Creates pickings and appropriate stock moves for given order lines, then
        confirms the moves, makes them available, and confirms the picking.
        @param partial_datas : Dictionary containing details of partial picking
        like  moves with product_id, product_qty, uom
        @return: Dictionary of values
        """
        assert len(ids) == 1, 'Partial picking processing may only be done one at a time'
        fuel_picking = self.pool.get('fuel.picking')
        stock_move = self.pool.get('stock.move')
        uom_obj = self.pool.get('product.uom')
        partial = self.browse(cr, uid, ids[0], context=context)
        partial_data = {
            'delivery_date' : partial.date
        }
        picking_type = partial.picking_id.type
        for wizard_line in partial.move_ids:
            #added by nctr
            quantity = uom_obj._compute_qty(cr, uid, wizard_line.product_uom.id, wizard_line.quantity, wizard_line.move_id.product_uom.id)
            #Adding a check whether any move line contains exceeding  real location qty to original moveline
            context = {}
            c = context.copy()
            c['uom']=wizard_line.product_uom.id
            c['location'] = wizard_line.move_id.location_id.id
            product = self.pool.get('product.product').browse(cr, uid, wizard_line.move_id.product_id.id, context=c)
            if wizard_line.quantity < 0:
                raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
            if quantity  > wizard_line.move_id.product_qty:
                raise osv.except_osv(_('Processing Error'), _('Processing quantity for is larger than the available quantity !'))

            if (wizard_line.move_id.fuel_picking_id.type in ['out','internal']) and (quantity > product.qty_available ):
                    raise osv.except_osv(_('Warning'),_('Processing quantity  is larger than the available quantity in is location!'))

            line_uom = wizard_line.product_uom
            move_id = wizard_line.move_id.id
            #finish
            #Quantiny must be Positive
            if wizard_line.quantity < 0:
                raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))

            #Compute the quantity for respective wizard_line in the line uom (this jsut do the rounding if necessary)
            qty_in_line_uom = uom_obj._compute_qty(cr, uid, line_uom.id, wizard_line.quantity, line_uom.id)

            if line_uom.factor and line_uom.factor <> 0:
                if float_compare(qty_in_line_uom, wizard_line.quantity, precision_rounding=line_uom.rounding) != 0:
                    raise osv.except_osv(_('Warning'), _('The uom rounding does not allow you to ship "%s %s", only roundings of "%s %s" is accepted by the uom.') % (wizard_line.quantity, line_uom.name, line_uom.rounding, line_uom.name))
            if move_id:
                #Check rounding Quantity.ex.
                #picking: 1kg, uom kg rounding = 0.01 (rounding to 10g), 
                #partial delivery: 253g
                #=> result= refused, as the qty left on picking would be 0.747kg and only 0.75 is accepted by the uom.
                initial_uom = wizard_line.move_id.product_uom
                #Compute the quantity for respective wizard_line in the initial uom
                qty_in_initial_uom = uom_obj._compute_qty(cr, uid, line_uom.id, wizard_line.quantity, initial_uom.id)
                without_rounding_qty = (wizard_line.quantity / line_uom.factor) * initial_uom.factor
                if float_compare(qty_in_initial_uom, without_rounding_qty, precision_rounding=initial_uom.rounding) != 0:
                    raise osv.except_osv(_('Warning'), _('The rounding of the initial uom does not allow you to ship "%s %s", as it would let a quantity of "%s %s" to ship and only roundings of "%s %s" is accepted by the uom.') % (wizard_line.quantity, line_uom.name, wizard_line.move_id.product_qty - without_rounding_qty, initial_uom.name, initial_uom.rounding, initial_uom.name))
            else:
                seq_obj_name =  'fuel.picking.' + picking_type
                move_id = stock_move.create(cr,uid,{'name' : self.pool.get('ir.sequence').get(cr, uid, seq_obj_name),
                                                    'product_id': wizard_line.product_id.id,
                                                    'product_qty': wizard_line.quantity,
                                                    'product_uom': wizard_line.product_uom.id,
                                                    'prodlot_id': wizard_line.prodlot_id.id,
                                                    'location_id' : wizard_line.location_id.id,
                                                    'location_dest_id' : wizard_line.location_dest_id.id,
                                                    'fuel_picking_id': partial.picking_id.id
                                                    },context=context)
                stock_move.action_confirm(cr, uid, [move_id], context)
            partial_data['move%s' % (move_id)] = {
                'product_id': wizard_line.product_id.id,
                'product_qty': wizard_line.quantity,
                'product_uom': wizard_line.product_uom.id,
                'prodlot_id': wizard_line.prodlot_id.id,
            }
            if (picking_type == 'in') and (wizard_line.product_id.cost_method == 'average'):
                partial_data['move%s' % (wizard_line.move_id.id)].update(product_price=wizard_line.cost,
                                                                  product_currency=wizard_line.currency.id)
        fuel_picking.do_partial(cr, uid, [partial.picking_id.id], partial_data, context=context)
        return {'type': 'ir.actions.act_window_close'}
    def do_partial(self, cr, uid, ids, context=None):
        assert len(ids) == 1, 'Partial picking processing may only be done one at a time'
        stock_picking = self.pool['stock.picking']
        stock_move = self.pool['stock.move']
        pallet_move_obj = self.pool['pallet.move']
        uom_obj = self.pool['product.uom']
        partial = self.browse(cr, uid, ids[0], context=context)
        partial_data = {
            'delivery_date': partial.date
        }
        picking_type = partial.picking_id.type
        pallet = {}
        for wizard_line in partial.move_ids:
            line_uom = wizard_line.product_uom
            move_id = wizard_line.move_id.id

            #Quantiny must be Positive
            if wizard_line.quantity < 0:
                raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))

            #Compute the quantity for respective wizard_line in the line uom (this jsut do the rounding if necessary)
            qty_in_line_uom = uom_obj._compute_qty(cr, uid, line_uom.id, wizard_line.quantity, line_uom.id)

            if line_uom.factor and line_uom.factor != 0:
                if float_compare(qty_in_line_uom, wizard_line.quantity, precision_rounding=line_uom.rounding) != 0:
                    raise osv.except_osv(_('Warning'), _('The uom rounding does not allow you to ship "%s %s", only roundings of "%s %s" is accepted by the uom.') % (wizard_line.quantity, line_uom.name, line_uom.rounding, line_uom.name))
            if move_id:
                #Check rounding Quantity.ex.
                #picking: 1kg, uom kg rounding = 0.01 (rounding to 10g),
                #partial delivery: 253g
                #=> result= refused, as the qty left on picking would be 0.747kg and only 0.75 is accepted by the uom.
                initial_uom = wizard_line.move_id.product_uom
                #Compute the quantity for respective wizard_line in the initial uom
                qty_in_initial_uom = uom_obj._compute_qty(cr, uid, line_uom.id, wizard_line.quantity, initial_uom.id)
                without_rounding_qty = (wizard_line.quantity / line_uom.factor) * initial_uom.factor
                if float_compare(qty_in_initial_uom, without_rounding_qty, precision_rounding=initial_uom.rounding) != 0:
                    raise osv.except_osv(_('Warning'), _('The rounding of the initial uom does not allow you to ship "%s %s", as it would let a quantity of "%s %s" to ship and only roundings of "%s %s" is accepted by the uom.') % (wizard_line.quantity, line_uom.name, wizard_line.move_id.product_qty - without_rounding_qty, initial_uom.name, initial_uom.rounding, initial_uom.name))
            else:
                seq_obj_name = 'stock.picking.' + picking_type
                move_id = stock_move.create(cr, uid, {'name': self.pool['ir.sequence'].get(cr, uid, seq_obj_name),
                                            'product_id': wizard_line.product_id.id,
                                            'product_qty': wizard_line.quantity,
                                            'product_uom': wizard_line.product_uom.id,
                                            'prodlot_id': wizard_line.prodlot_id.id,
                                            'location_id': wizard_line.location_id.id,
                                            'location_dest_id': wizard_line.location_dest_id.id,
                                            'picking_id': partial.picking_id.id
                                                      }, context=context)
                stock_move.action_confirm(cr, uid, [move_id], context)
            
            # Pack tracking
            existing_tracking = wizard_line.tracking_id.id
            
            if existing_tracking:  # avoid creating a tracking twice
                #self.pool['stock.tracking').write(cr, uid, existing_tracking, {'name': partial.tracking_code})
                tracking_id = existing_tracking
            else:
                if partial.tracking_code:
                    tracking_id = self.pool['stock.tracking'].search(cr, uid, [('name', '=', partial.tracking_code)])
                    
                    if not tracking_id:
                        tracking_id = self.pool['stock.tracking'].create(cr, uid, {
                            'name': partial.tracking_code,
                        })
                    else:
                        tracking_id = tracking_id[0]
                    
                    self.pool['stock.move'].write(cr, uid, move_id, {'tracking_id': tracking_id})
                    tracking_id = int(tracking_id)
                else:
                    tracking_id = None
            
            partial_data['move%s' % (move_id)] = {
                'product_id': wizard_line.product_id.id,
                'product_qty': wizard_line.quantity,
                'product_uom': wizard_line.product_uom.id,
                'prodlot_id': wizard_line.prodlot_id.id,
                'balance': wizard_line.balance,
                'tracking_id': tracking_id,
                'pallet_qty': wizard_line.pallet_qty,
                'pallet_id': wizard_line.pallet_id.id, 
            }
            if (picking_type == 'in') and (wizard_line.product_id.cost_method == 'average'):
                partial_data['move%s' % (wizard_line.move_id.id)].update(product_price=wizard_line.cost,
                                                                         product_currency=wizard_line.currency.id)
            # compose the pallet list
            if not wizard_line.pallet_id.id in pallet:
                pallet[wizard_line.pallet_id.id] = 0
            pallet[wizard_line.pallet_id.id] += wizard_line.pallet_qty
            
        #here i want to create 2 lines

        for pallet_id, pallet_qty in pallet.iteritems():
            if pallet_qty:
                pallet_move_obj.create(cr, uid, {
                    'name': partial.picking_id.name,
                    'date': partial.picking_id.date,
                    'partner_id': partial.picking_id.partner_id.id,
                    'move': partial.picking_id.type,
                    'stock_picking_id': partial.picking_id.id,
                    'pallet_qty': pallet_qty,
                    'pallet_id': pallet_id,
                })
        
        stock_picking.do_partial(cr, uid, [partial.picking_id.id], partial_data, context=context)
        return {'type': 'ir.actions.act_window_close'}
    def do_partial(self, cr, uid, ids, context=None):

        partial = self.browse(cr, uid, ids[0], context=context)
        if partial.picking_id and partial.picking_id.type == 'out':
            for wizard_line in partial.move_ids:
                if wizard_line.quantity > wizard_line.original_quantity:
                    raise osv.except_osv(
                        _('Error'),
                        _("Original Quantity in line was %s is not allowed to assign %s"
                          % (wizard_line.original_quantity,
                             wizard_line.quantity)))

        assert len(
            ids
        ) == 1, 'Partial picking processing may only be done one at a time'
        stock_picking = self.pool.get('stock.picking')
        stock_move = self.pool.get('stock.move')
        uom_obj = self.pool.get('product.uom')
        partial = self.browse(cr, uid, ids[0], context=context)
        partial_data = {'delivery_date': partial.date}
        picking_type = partial.picking_id.type
        for wizard_line in partial.move_ids:
            line_uom = wizard_line.product_uom
            move_id = wizard_line.move_id.id

            #Quantiny must be Positive
            if wizard_line.quantity < 0:
                raise osv.except_osv(_('Warning!'),
                                     _('Please provide Proper Quantity !'))

            #Compute the quantity for respective wizard_line in the line uom (this jsut do the rounding if necessary)
            qty_in_line_uom = uom_obj._compute_qty(cr, uid, line_uom.id,
                                                   wizard_line.quantity,
                                                   line_uom.id)

            if line_uom.factor and line_uom.factor <> 0:
                if float_compare(qty_in_line_uom,
                                 wizard_line.quantity,
                                 precision_rounding=line_uom.rounding) != 0:
                    raise osv.except_osv(
                        _('Warning'),
                        _('The uom rounding does not allow you to ship "%s %s", only roundings of "%s %s" is accepted by the uom.'
                          ) % (wizard_line.quantity, line_uom.name,
                               line_uom.rounding, line_uom.name))
            if move_id:
                #Check rounding Quantity.ex.
                #picking: 1kg, uom kg rounding = 0.01 (rounding to 10g),
                #partial delivery: 253g
                #=> result= refused, as the qty left on picking would be 0.747kg and only 0.75 is accepted by the uom.
                initial_uom = wizard_line.move_id.product_uom
                #Compute the quantity for respective wizard_line in the initial uom
                qty_in_initial_uom = uom_obj._compute_qty(
                    cr, uid, line_uom.id, wizard_line.quantity, initial_uom.id)
                without_rounding_qty = (wizard_line.quantity /
                                        line_uom.factor) * initial_uom.factor
                if float_compare(qty_in_initial_uom,
                                 without_rounding_qty,
                                 precision_rounding=initial_uom.rounding) != 0:
                    raise osv.except_osv(
                        _('Warning'),
                        _('The rounding of the initial uom does not allow you to ship "%s %s", as it would let a quantity of "%s %s" to ship and only roundings of "%s %s" is accepted by the uom.'
                          ) % (wizard_line.quantity, line_uom.name,
                               wizard_line.move_id.product_qty -
                               without_rounding_qty, initial_uom.name,
                               initial_uom.rounding, initial_uom.name))
            else:
                seq_obj_name = 'stock.picking.' + picking_type
                move_id = stock_move.create(
                    cr,
                    uid, {
                        'name':
                        self.pool.get('ir.sequence').get(
                            cr, uid, seq_obj_name),
                        'product_id':
                        wizard_line.product_id.id,
                        'product_qty':
                        wizard_line.quantity,
                        'product_uom':
                        wizard_line.product_uom.id,
                        'prodlot_id':
                        wizard_line.prodlot_id.id,
                        'location_id':
                        wizard_line.location_id.id,
                        'location_dest_id':
                        wizard_line.location_dest_id.id,
                        'picking_id':
                        partial.picking_id.id
                    },
                    context=context)
                stock_move.action_confirm(cr, uid, [move_id], context)
            partial_data['move%s' % (move_id)] = {
                'product_id': wizard_line.product_id.id,
                'product_qty': wizard_line.quantity,
                'product_uom': wizard_line.product_uom.id,
                'prodlot_id': wizard_line.prodlot_id.id,
            }
            if (picking_type == 'in') and (wizard_line.product_id.cost_method
                                           == 'average'):
                partial_data['move%s' % (wizard_line.move_id.id)].update(
                    product_price=wizard_line.cost,
                    product_currency=wizard_line.currency.id)

        picking_id = stock_picking.do_partial(cr,
                                              uid, [partial.picking_id.id],
                                              partial_data,
                                              context=context)
        new_picking_id = []
        for ids in picking_id:
            new_picking_id.append(picking_id[ids]['delivered_picking'])

        if len(new_picking_id
               ) == 1 and 'eshop_picking_tree' not in context.keys():
            vals = {
                'name': _("Picking Processed"),
                'view_mode': 'form',
                'view_id': False,
                'view_type': 'form',
                'res_model': 'stock.picking',
                'res_id': new_picking_id[0],
                'type': 'ir.actions.act_window',
                'nodestroy': False,
                'domain': '[]',
                'context': context,
            }
        else:
            vals = {'type': 'ir.actions.act_window_close'}
        return vals
    def do_partial(self, cr, uid, ids, context=None):
        assert len(
            ids
        ) == 1, 'Partial picking processing may only be done one at a time'
        stock_picking = self.pool['stock.picking']
        stock_move = self.pool['stock.move']
        pallet_move_obj = self.pool['pallet.move']
        uom_obj = self.pool['product.uom']
        partial = self.browse(cr, uid, ids[0], context=context)
        partial_data = {'delivery_date': partial.date}
        picking_type = partial.picking_id.type
        pallet = {}
        for wizard_line in partial.move_ids:
            line_uom = wizard_line.product_uom
            move_id = wizard_line.move_id.id

            # Quantity must be Positive
            if wizard_line.quantity < 0:
                raise orm.except_orm(_('Warning!'),
                                     _('Please provide Proper Quantity !'))

            if wizard_line.quantity > 0 and wizard_line.tracking and not (
                    wizard_line.prodlot_id or wizard_line.new_prodlot_code):
                raise orm.except_orm(
                    _('Error!'),
                    _('Please provide lot on product "%s"' %
                      wizard_line.product_id.name))

            # Compute the quantity for respective wizard_line in the line uom (this jsut do the rounding if necessary)
            qty_in_line_uom = uom_obj._compute_qty(cr, uid, line_uom.id,
                                                   wizard_line.quantity,
                                                   line_uom.id)

            if line_uom.factor and line_uom.factor != 0:
                if float_compare(qty_in_line_uom,
                                 wizard_line.quantity,
                                 precision_rounding=line_uom.rounding) != 0:
                    raise orm.except_orm(
                        _('Warning'),
                        _('The uom rounding does not allow you to ship "%s %s", only roundings of "%s %s" is accepted by the uom.'
                          ) % (wizard_line.quantity, line_uom.name,
                               line_uom.rounding, line_uom.name))
            if move_id:
                # Check rounding Quantity.ex.
                # picking: 1kg, uom kg rounding = 0.01 (rounding to 10g),
                # partial delivery: 253g
                # => result= refused, as the qty left on picking would be 0.747kg and only 0.75 is accepted by the uom.
                initial_uom = wizard_line.move_id.product_uom
                # Compute the quantity for respective wizard_line in the initial uom
                qty_in_initial_uom = uom_obj._compute_qty(
                    cr, uid, line_uom.id, wizard_line.quantity, initial_uom.id)
                without_rounding_qty = (wizard_line.quantity /
                                        line_uom.factor) * initial_uom.factor
                if float_compare(qty_in_initial_uom,
                                 without_rounding_qty,
                                 precision_rounding=initial_uom.rounding) != 0:
                    raise orm.except_orm(
                        _('Warning'),
                        _('The rounding of the initial uom does not allow you to ship "%s %s", as it would let a quantity of "%s %s" to ship and only roundings of "%s %s" is accepted by the uom.'
                          ) % (wizard_line.quantity, line_uom.name,
                               wizard_line.move_id.product_qty -
                               without_rounding_qty, initial_uom.name,
                               initial_uom.rounding, initial_uom.name))
            else:
                seq_obj_name = 'stock.picking.' + picking_type
                move_id = stock_move.create(
                    cr,
                    uid, {
                        'name': self.pool['ir.sequence'].get(
                            cr, uid, seq_obj_name),
                        'product_id': wizard_line.product_id.id,
                        'product_qty': wizard_line.quantity,
                        'product_uom': wizard_line.product_uom.id,
                        'prodlot_id': wizard_line.prodlot_id.id,
                        'location_id': wizard_line.location_id.id,
                        'location_dest_id': wizard_line.location_dest_id.id,
                        'picking_id': partial.picking_id.id
                    },
                    context=context)
                stock_move.action_confirm(cr, uid, [move_id], context)

            # Pack tracking
            existing_tracking = wizard_line.tracking_id.id

            if existing_tracking:  # avoid creating a tracking twice
                # self.pool['stock.tracking').write(cr, uid, existing_tracking, {'name': partial.tracking_code})
                tracking_id = existing_tracking
            else:
                if partial.tracking_code:
                    tracking_id = self.pool['stock.tracking'].search(
                        cr, uid, [('name', '=', partial.tracking_code)])

                    if not tracking_id:
                        tracking_id = self.pool['stock.tracking'].create(
                            cr, uid, {
                                'name': partial.tracking_code,
                            })
                    else:
                        tracking_id = tracking_id[0]

                    self.pool['stock.move'].write(cr, uid, move_id,
                                                  {'tracking_id': tracking_id})
                    tracking_id = int(tracking_id)
                else:
                    tracking_id = None

            partial_data['move%s' % move_id] = {
                'product_id': wizard_line.product_id.id,
                'product_qty': wizard_line.quantity,
                'product_uom': wizard_line.product_uom.id,
                'prodlot_id': wizard_line.prodlot_id.id,
                'balance': wizard_line.balance,
                'tracking_id': tracking_id,
                'pallet_qty': wizard_line.pallet_qty,
                'pallet_id': wizard_line.pallet_id.id,
            }
            if (picking_type == 'in') and (wizard_line.product_id.cost_method
                                           == 'average'):
                partial_data['move%s' % wizard_line.move_id.id].update(
                    product_price=wizard_line.cost,
                    product_currency=wizard_line.currency.id)
            # compose the pallet list
            if wizard_line.pallet_id.id not in pallet:
                pallet[wizard_line.pallet_id.id] = 0
            pallet[wizard_line.pallet_id.id] += wizard_line.pallet_qty

        # here i want to create 2 lines

        for pallet_id, pallet_qty in pallet.iteritems():
            if pallet_qty:
                pallet_move_obj.create(
                    cr,
                    uid, {
                        'name': partial.picking_id.name,
                        'date': partial.picking_id.date,
                        'partner_id': partial.picking_id.partner_id.id,
                        'move': partial.picking_id.type,
                        'stock_picking_id': partial.picking_id.id,
                        'pallet_qty': pallet_qty,
                        'pallet_id': pallet_id,
                    },
                    context=context)

        delivered_pack_id = stock_picking.do_partial(cr,
                                                     uid,
                                                     [partial.picking_id.id],
                                                     partial_data,
                                                     context=context)

        if picking_type == 'in':
            res = self.pool['ir.model.data'].get_object_reference(
                cr, uid, 'stock', 'view_picking_in_form')
        else:
            res = self.pool['ir.model.data'].get_object_reference(
                cr, uid, 'stock', 'view_picking_out_form')

        vals = {
            'type': 'ir.actions.act_window',
            'name': _('Delivered'),
            'view_type': 'form',
            'view_mode': 'form',
            'view_id': res and res[1] or False,
            'res_model': 'stock.picking',
            'nodestroy': True,
            'target': 'current',
            'res_id': int(delivered_pack_id[partial.picking_id.id]),
        }

        if partial.picking_id.id == vals['res_id']:
            vals['type'] = 'ir.actions.act_window_close'
        return vals