'Creates stock move for operation and stock move for final product of repair order.
@return: Move ids of final products'

@api.multi
def action_repair_done(self):

    if self.filtered((lambda repair: (not repair.repaired))):
        raise UserError(_('Repair    must    be    repaired    in    order    to    make    the    product    moves.'))
    res = {}
    Move = self.env['stock.move']
    for repair in self:
        moves = self.env['stock.move']
        for operation in repair.operations:
            move = Move.create({'name': operation.name, 'product_id': operation.product_id.id, 'restrict_lot_id': operation.lot_id.id, 'product_uom_qty': operation.product_uom_qty, 'product_uom': operation.product_uom.id, 'partner_id': repair.address_id.id, 'location_id': operation.location_id.id, 'location_dest_id': operation.location_dest_id.id})
            moves |= move
            operation.write({'move_id': move.id, 'state': 'done'})
        move = Move.create({'name': repair.name, 'product_id': repair.product_id.id, 'product_uom': (repair.product_uom.id or repair.product_id.uom_id.id), 'product_uom_qty': repair.product_qty, 'partner_id': repair.address_id.id, 'location_id': repair.location_id.id, 'location_dest_id': repair.location_dest_id.id, 'restrict_lot_id': repair.lot_id.id})
        moves |= move
        moves.action_done()
        res[repair.id] = move.id
    return res
