'Splits qty from move move into a new move
:param qty: float. quantity to split (given in product UoM)
:param restrict_lot_id: optional production lot that can be given in order to force the new move to restrict its choice of quants to this lot.
:param restrict_partner_id: optional partner that can be given in order to force the new move to restrict its choice of quants to the ones belonging to this partner.
:param context: dictionay. can contains the special key \'source_location_id\' in order to force the source location when copying the move
:returns: id of the backorder move created'

@api.multi
def split(self, qty, restrict_lot_id=False, restrict_partner_id=False):

    self = self.with_prefetch()
    if (self.state in ('done', 'cancel')):
        raise UserError(_('You    cannot    split    a    move    done'))
    elif (self.state == 'draft'):
        raise UserError(_('You    cannot    split    a    draft    move.    It    needs    to    be    confirmed    first.'))
    if (float_is_zero(qty, precision_rounding=self.product_id.uom_id.rounding) or (self.product_qty <= qty)):
        return self.id
    uom_qty = self.product_id.uom_id._compute_quantity(qty, self.product_uom, rounding_method='HALF-UP')
    defaults = {'product_uom_qty': uom_qty, 'procure_method': 'make_to_stock', 'restrict_lot_id': restrict_lot_id, 'split_from': self.id, 'procurement_id': self.procurement_id.id, 'move_dest_id': self.move_dest_id.id, 'origin_returned_move_id': self.origin_returned_move_id.id}
    if restrict_partner_id:
        defaults['restrict_partner_id'] = restrict_partner_id
    if self.env.context.get('source_location_id'):
        defaults['location_id'] = self.env.context['source_location_id']
    new_move = self.copy(defaults)
    self.with_context(do_not_propagate=True).write({'product_uom_qty': (self.product_uom_qty - uom_qty)})
    if (self.move_dest_id and self.propagate and (self.move_dest_id.state not in ('done', 'cancel'))):
        new_move_prop = self.move_dest_id.split(qty)
        new_move.write({'move_dest_id': new_move_prop})
    new_move.action_confirm()
    return new_move.id
